DEV Community

Discussion on: Better error handling with async/await

 
sobiodarlington profile image
Sobio Darlington

Your approach is also good.

I understand your intention from this response.

When I tested your else_throw helper with a promise rejection, it returned and error object instead of throwing, which was the reason for my response. Unless I didn't test properly.

If it throws as expected then your approach will be a great alternative.

Thread Thread
 
ironsavior profile image
Erik Elmore

I must have forgotten to have it throw from the .catch() callback. I intended for it to throw.

Thread Thread
 
sobiodarlington profile image
Sobio Darlington

Yeah. That should be it.