You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that you are actively refactoring for various reasons. You should consider changing the error handling as well. In a few places you have something like the following.
try{if(err){returncallback(err);}// more stuff}catch(e){callback(e);}
The usage of the callback inside of your try-catch is bad, especially in streams. That callback quite often synchronously calls the emit method. The emit method will also intentionally re-throw errors if there are no handlers. This is done because crashing is better than silently swallowing errors.
I see that you are actively refactoring for various reasons. You should consider changing the error handling as well. In a few places you have something like the following.
The usage of the callback inside of your try-catch is bad, especially in streams. That callback quite often synchronously calls the
emit
method. Theemit
method will also intentionally re-throw errors if there are no handlers. This is done because crashing is better than silently swallowing errors.Alex Early explains this well: caolan/async#1458 (comment)
For most of your cases I suggest something like the following.
The text was updated successfully, but these errors were encountered: