UNPKG

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