Skip to content

Instantly share code, notes, and snippets.

@alsotang
Created November 5, 2015 06:37
Show Gist options
  • Save alsotang/831bf1f846ef274bb553 to your computer and use it in GitHub Desktop.
Save alsotang/831bf1f846ef274bb553 to your computer and use it in GitHub Desktop.
inherit from Error
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