Timeline for What's a good way to extend Error in JavaScript?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 4, 2020 at 10:27 | comment | added | Krisztián Balla | I like this. You bypass a limitation by using encapsulation instead of inheritance. | |
Jul 24, 2016 at 15:50 | comment | added | Peeyush Kushwaha |
Incredibly elegant solution, thanks for sharing! One variation : new MyErr (arg1, arg2, new Error()) and in MyErr constructor we use Object.assign to assign the last arg's properties to this
|
|
Jun 30, 2015 at 22:06 | comment | added | JoWie | I've released this solution as a npm package: npmjs.com/package/throwable | |
Aug 17, 2014 at 22:09 | history | edited | JoWie | CC BY-SA 3.0 |
"Error" is slightly shorter than "new Error"
|
Aug 16, 2014 at 22:58 | review | Late answers | |||
Aug 16, 2014 at 23:04 | |||||
Aug 16, 2014 at 22:39 | review | First posts | |||
Aug 16, 2014 at 22:49 | |||||
Aug 16, 2014 at 22:35 | history | answered | JoWie | CC BY-SA 3.0 |