@zondax/ledger-js
Version:
TS / Node API for apps running on Ledger devices
31 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResponseError = void 0;
const errors_1 = require("./errors");
/**
* Class representing a response error.
* Extends the built-in Error class to include additional properties.
*/
class ResponseError extends Error {
/**
* Creates an instance of ResponseError.
* @param returnCode - The return code associated with the error.
* @param errorMessage - The error message describing the error.
*/
constructor(returnCode, errorMessage) {
super(errorMessage);
this.errorMessage = errorMessage;
this.returnCode = returnCode;
}
/**
* Creates a ResponseError instance from a return code.
* @param returnCode - The return code to convert into a ResponseError.
* @param customErrorList - Custom error description list to convert error code with.
* @returns A new instance of ResponseError.
*/
static fromReturnCode(returnCode, customErrorList) {
return new ResponseError(returnCode, (0, errors_1.errorCodeToString)(returnCode, customErrorList));
}
}
exports.ResponseError = ResponseError;
//# sourceMappingURL=responseError.js.map