|
|
|
|
|
by winrid
860 days ago
|
|
no I would just do what makes sense to me, which is what I commented. you can do exceptions or type the return values. sounds like you want to do the latter. handling it isn't as nice as in rust though, I agree. You could create a simple object to emulate it though like "ReturnValue { unwrap: fn, ifOk: fn, ifErr: fn } " where unwrap throws if invalid, ifOk returns true if the response is valid, and ifErr returns true if an err. |
|