@getclave/lifi-sdk
Version:
LI.FI Any-to-Any Cross-Chain-Swap SDK
25 lines (24 loc) • 851 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SDKError = void 0;
const version_1 = require("../version");
// Note: SDKError is used to wrapper and present errors at the top level
// Where opportunity allows we also add the step and the process related to the error
class SDKError extends Error {
step;
process;
code;
name = 'SDKError';
cause;
constructor(cause, step, process) {
const errorMessage = `${cause.message ? `[${cause.name}] ${cause.message}` : 'Unknown error occurred'}\nLI.FI SDK version: ${version_1.version}`;
super(errorMessage);
this.name = 'SDKError';
this.step = step;
this.process = process;
this.cause = cause;
this.stack = this.cause.stack;
this.code = cause.code;
}
}
exports.SDKError = SDKError;