Created
June 27, 2018 12:55
-
-
Save bennycode/c5d0167886380e26d85ea9b2f1528aff to your computer and use it in GitHub Desktop.
Custom Error
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 NetworkError extends Error { | |
| constructor(public message: string) { | |
| super(message); | |
| Object.setPrototypeOf(this, NetworkError.prototype); | |
| this.name = 'NetworkError'; // Don't use "constructor.name" here because it won't work as expected when minifying the code ;) | |
| this.stack = new Error().stack; | |
| } | |
| } | |
| export {NetworkError}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment