Skip to content

Instantly share code, notes, and snippets.

@spion
Last active April 2, 2016 06:48
Show Gist options
  • Save spion/8293685 to your computer and use it in GitHub Desktop.
Save spion/8293685 to your computer and use it in GitHub Desktop.
function MyCustomError(message) {
this.message = message;
this.name = "MyCustomError";
Error.captureStackTrace(this, MyCustomError);
}
// or util.inherits(MyCustomError, Error);
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