Skip to content

Instantly share code, notes, and snippets.

Kurt Miller bsdkurt

View GitHub Profile
@justmoon
justmoon / custom-error.js
Last active Jul 11, 2020 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
View custom-error.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
You can’t perform that action at this time.