UNPKG

@speedup/error

Version:
44 lines (43 loc) 1.6 kB
"use strict"; /** * Argument error */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var error_base_1 = require("./error_base"); /** * Missing Argument Error */ var MissingArgumentError = /** @class */ (function (_super) { __extends(MissingArgumentError, _super); function MissingArgumentError(argumentName) { var _this = this; if (!argumentName) { throw new Error('E_ARG_NAME'); } _this = _super.call(this, { code: 'E_NO_ARG', message: "'" + argumentName + "' is not provided (null or undefined)." }) || this; _this.argumentName = argumentName; // set stacktrace Error.captureStackTrace(_this, MissingArgumentError); // Set prototype to make instanceOf enabled Object.setPrototypeOf(_this, MissingArgumentError.prototype); return _this; } return MissingArgumentError; }(error_base_1.ErrorBase)); exports.MissingArgumentError = MissingArgumentError;