-
-
Save Kirill89/77d8fc925ac32d999affc29d759480d6 to your computer and use it in GitHub Desktop.
Custom error in JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GoodError extends Error { | |
| constructor(...args) { | |
| super(...args); | |
| this.name = 'GoodError'; | |
| Error.captureStackTrace(this, GoodError); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class GoodError extends Error { | |
| public name = 'GoodError'; | |
| constructor(...args) { | |
| super(...args); | |
| Error.captureStackTrace(this, GoodError); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JSON.stringify(err, Object.getOwnPropertyNames(err))