Skip to content

Instantly share code, notes, and snippets.

View SecSamDev's full-sized avatar

Samuel Garcés Marín SecSamDev

View GitHub Profile
@SecSamDev
SecSamDev / custom-error.js
Created August 6, 2018 06:52 — forked from justmoon/custom-error.js
Creating custom Error classes in Node.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);