UNPKG

extendo-error

Version:

Safely and simply extend native Error with prototype chaining support

29 lines (28 loc) 831 B
"use strict"; var ExtendoError = (function () { function ExtendoError(message) { this._message = null; this._message = message; Object.setPrototypeOf(ExtendoError.prototype, Error.prototype); } Object.defineProperty(ExtendoError.prototype, "message", { get: function () { return this._message; }, set: function (message) { this._message = message; }, enumerable: true, configurable: true }); Object.defineProperty(ExtendoError.prototype, "name", { get: function () { return this.constructor.name; }, enumerable: true, configurable: true }); return ExtendoError; }()); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ExtendoError;