Created
November 5, 2015 06:37
-
-
Save alsotang/831bf1f846ef274bb553 to your computer and use it in GitHub Desktop.
inherit from 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
function MyCustomError(message) { | |
this.message = message; | |
this.name = "MyCustomError"; | |
Error.captureStackTrace(this, MyCustomError); | |
} | |
MyCustomError.prototype = Object.create(Error.prototype); | |
MyCustomError.prototype.constructor = MyCustomError; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment