UNPKG

1.31 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var AccountsError = /** @class */ (function (_super) {
5 tslib_1.__extends(AccountsError, _super);
6 function AccountsError(packageName, functionName, reason) {
7 var _this = this;
8 // Build Error message from parameters
9 var message = reason
10 ? "[ Accounts - " + packageName + " ] " + functionName + " : " + reason
11 : packageName;
12 // Build the underlying Error
13 _this = _super.call(this, message) || this;
14 // Assign parameters for future use
15 _this.packageName = packageName;
16 _this.functionName = functionName;
17 _this.reason = reason;
18 // Set the prototype to AccountsError so "instanceof AccountsError" returns true
19 Object.setPrototypeOf(_this, AccountsError.prototype);
20 // Recapture the stack trace to avoid this function to be in it
21 if (typeof Error.captureStackTrace === 'function') {
22 Error.captureStackTrace(_this, _this.constructor);
23 }
24 else {
25 _this.stack = new Error(message).stack;
26 }
27 return _this;
28 }
29 return AccountsError;
30}(Error));
31exports.default = AccountsError;
32//# sourceMappingURL=accounts-error.js.map
\No newline at end of file