-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception chaining/stack #38
Comments
Have a look at https://github.com/mathew-kurian/TraceError.js |
Is anyone else interested by this feature ? May be a good idea to add an example custom error that do exception stack... but not in the core source IMO. PR are welcome ;) |
Actually v8 and TC39 standards now mean that JS has native cause chaining. More info: https://stackoverflow.com/questions/22303633/set-error-cause-in-javascript-node-js Node.js (16.9+). This means to support it, you just need to update your In order nodejs, the second parameter would just be ignored. |
Hello, I did not saw your message, sorry... this is awesome! |
@CMCDragonkai I introduced the support in https://github.com/adriengibrat/ts-custom-error/releases/tag/v3.3.0 Update of doc and improvements are still welcome ;) |
version 3.3.1 is compatible with Error option / cause & Exception chaining. |
I'm wondering if
ts-custom-error
can extend JS's native errors with the capability of doing exception stacking.Basically similar to Python's
raise e from ...
. Where you can chain your exceptions.This would be useful as often happens is that some exception comes from somewhere else, and you want to wrap that exception with your own exception but you still want to preserve the original exception.
The text was updated successfully, but these errors were encountered: