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
Sometime it's useful to catch some known errors and convert them to erroz-errors. Unfortunately those errorz-erros have the stacktrace of erroz-creation. It might be helpful to add an option to pass an original error when creating an erroz-error instance to append the original error.
Something like:
varParseError=erroz({statusCode: 400,status: "fail",name: "ParseError",code: "parse-error",template"Could not parse %what"});try{JSON.parse("xaz--");}catch(err){//pass original err as second argument (optional)errozErr=newParseError({what: "ever"},err);console.log(errozErr.stack)//would equal err.stack }
Although it seems convenient it's also confusing as the stack is not pointing to the real "throw" . Maybe it's possible to merge the stacks or introduce a second originalStack attribute.
The text was updated successfully, but these errors were encountered:
These should probably stay to different errors. The first error is an internal parse error that doesn't know the context, and the second one is the "public" error that is printed to the user. Imho it's ok that these are two distinct errors.
It's just pain in the ass if you're using a global error handler which catches all unhandled errors and swallows the actual stack. But maybe we should leave it to application logic..
Sometime it's useful to catch some known errors and convert them to erroz-errors. Unfortunately those errorz-erros have the stacktrace of erroz-creation. It might be helpful to add an option to pass an original error when creating an erroz-error instance to append the original error.
Something like:
Although it seems convenient it's also confusing as the stack is not pointing to the real "throw" . Maybe it's possible to merge the stacks or introduce a second
originalStack
attribute.The text was updated successfully, but these errors were encountered: