Can we not use extended classes to achieve this goal?
mantou132 opened this issue · 3 comments
mantou132 commented
Users can customize errors, for example:
class MyError extends Error {
constructor(msg, cause) {
super(msg);
this.cause = cause;
}
}
legendecas commented
While there are lots of ways to achieve the behavior of the proposal, if the cause
property is explicitly defined by the language, debug tooling can reliably use this info rather than contracting with developers to construct an error properly.
legendecas commented
Closed. Feel free to comment or reopen if there are any further questions :)
bertho-zero commented
https://github.com/Oagenda/verror does it perfectly. :)