JS-DevTools / ono

Wrap errors without losing the original message, stack trace, or properties
https://jstools.dev/ono/
MIT License
106 stars 11 forks source link

feat: preserve stack trace of all errors in chain #16

Open petermetz opened 3 years ago

petermetz commented 3 years ago

Hiya, thank you for this great library!

I was wondering if this is possible to do today or if it could be implemented as an enhancement?

Right now the stack trace is only preserved for the original error, but ideally I'd want to know all the stack traces of all errors in the chain in case the message does not uniquely identify the location in the code where the error was thrown. This is especially useful with longer chains where 3 or 4 or more re-throws happen before the exception is finally logged.