UNPKG

extendo-error

Version:

Safely and simply extend native Error with prototype chaining support

38 lines (37 loc) 1.22 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var extendo_error_1 = require("../src/extendo-error"); var ChildError = (function (_super) { __extends(ChildError, _super); function ChildError() { var _this = _super.apply(this, arguments) || this; _this.aMagicNumber = 3; _this.theWord = "bird"; return _this; } Object.defineProperty(ChildError.prototype, "theAnswer", { get: function () { return 42; }, enumerable: true, configurable: true }); Object.defineProperty(ChildError.prototype, "thisMuch", { get: function () { return true; }, enumerable: true, configurable: true }); ChildError.prototype.doSomething = function () { }; ChildError.prototype.doSomethingElse = function () { }; return ChildError; }(extendo_error_1.default)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ChildError;