livepeer / go-tools

Utility packages used across Livepeer Go repositories.
0 stars 2 forks source link

Do not panic inside driver's code #13

Open leszko opened 1 year ago

leszko commented 1 year ago

Comments from @victorges

An alternative could be returning a "broken session" that returns errors for all function calls. The nil session should just cause a panic as well on code that ends up going this.

The basic thing I don't like about a panic or nil here is that it can be caused entirely by user input. The same code that works for an s3+https driver would explode is the user input is changed to w3s instead.

So I'd be fine with any handling of the filename here even if not super useful to avoid panicking on consumer code. Like returning the failed session, or maybe just prepending every file name in the CAR with the one provided for the session here.

Ok doing this as a follow-up or even just filling an issue to figure out a better error handling for the w3s session.