AriaMinaei / pretty-error

See node.js errors with less clutter
MIT License
1.52k stars 48 forks source link

Support nesting with cause #64

Open conartist6 opened 2 years ago

conartist6 commented 2 years ago

I'm building an application which really needs nested errors. The fs can throw, but in my application just seeing what failed isn't enough to understand what action was being attempted when a failure occurred. Instead I must catch the source error, attach some additional context, and rethrow.

I'd like to be able to attach the original error as a cause. Spec-level support for this is already underway. A shim has been published as well, but while it can get a cause property set up correctly, it doesn't contain any logic about rendering causes. This library has an opportunity to be the first to present such information in a useful way and kickstart the community's ability to use this feature.

I'm going to make a fork and see what I can do.

conartist6 commented 2 years ago

The only slight problem is that my personal temptation is to hard fork it as I don't know coffeescript and I don't want to.

AriaMinaei commented 2 years ago

Supporting cause sounds like a good idea!

As to coffeescript, I'll be happy to merge back TS or ESNext :)