Created
June 20, 2018 18:52
-
-
Save edujr1/402c4ee0235490fc905bc894b9c8d1fa to your computer and use it in GitHub Desktop.
Criação da própria chamada de erro em 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
function MyError(message) { | |
this.name = 'MyError'; | |
this.message = message; | |
this.stack = (new Error()).stack; | |
} | |
MyError.prototype = new Error; // <-- remove this if you do not | |
// want MyError to be instanceof Error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment