@graphistry/falcor
Version:
A JavaScript library for efficient data fetching.
19 lines (17 loc) • 539 B
JavaScript
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;
}