UNPKG

@graphistry/falcor

Version:
19 lines (17 loc) 539 B
module.exports = createErrorClass; function createErrorClass(name, init) { function E(message) { this.message = message; init && init.apply(this, arguments); if (!Error.captureStackTrace) { this.stack = (new Error()).stack; } else { Error.captureStackTrace(this, this.constructor); } } E.prototype = Object.create(Error.prototype); E.prototype.name = name; E.prototype.constructor = E; E.is = function(x) { return x.name === name; }; return E; }