UNPKG

@cruxpay/js-sdk

Version:

CruxPay Javascript SDK

37 lines (36 loc) 1.55 kB
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 __()); }; })(); var BaseError = /** @class */ (function (_super) { __extends(BaseError, _super); function BaseError(cause, message, code, skipStackStructuring) { var _newTarget = this.constructor; if (skipStackStructuring === void 0) { skipStackStructuring = false; } var _this = _super.call(this, message) || this; Object.setPrototypeOf(_this, _newTarget.prototype); _this.name = _this.constructor.name; if (!skipStackStructuring) { // Appending code as stack prefix if available if (code && _this.stack) { _this.stack = ("(" + code + ") ").concat(_this.stack); } // Preserving the stack of the cause for ease of debugging if (_this.stack && cause && cause.stack) { _this.stack = _this.stack.concat("\n\n").concat(cause.stack); } } return _this; } return BaseError; }(Error)); export { BaseError };