Skip to content

Instantly share code, notes, and snippets.

@simongong
Created May 10, 2016 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simongong/57c6568cbecfe0a4bd426717e85ccae1 to your computer and use it in GitHub Desktop.
Save simongong/57c6568cbecfe0a4bd426717e85ccae1 to your computer and use it in GitHub Desktop.
JavaScript: a customized error class
const Util = require('util');
module.exports = function AlpOpenError(message, extra) {
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
Util.inherits(module.exports, Error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment