Skip to content

Instantly share code, notes, and snippets.

@edujr1
Created June 20, 2018 18:52
Show Gist options
  • Save edujr1/402c4ee0235490fc905bc894b9c8d1fa to your computer and use it in GitHub Desktop.
Save edujr1/402c4ee0235490fc905bc894b9c8d1fa to your computer and use it in GitHub Desktop.
Criação da própria chamada de erro em JS
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