UNPKG

@gnolang/tm2-js-client

Version:

Tendermint2 JS / TS Client

57 lines (56 loc) 2.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.constructRequestError = void 0; var errors_1 = require("../errors"); /** * Constructs the appropriate Tendermint2 * error based on the error ID. * Error IDs retrieved from: * https://github.com/gnolang/gno/blob/64f0fd0fa44021a076e1453b1767fbc914ed3b66/tm2/pkg/std/package.go#L20C1-L38 * @param {string} errorID the proto ID of the error * @param {string} [log] the log associated with the error, if any * @returns {TM2Error} */ var constructRequestError = function (errorID, log) { switch (errorID) { case '/std.InternalError': return new errors_1.InternalError(log); case '/std.TxDecodeError': return new errors_1.TxDecodeError(log); case '/std.InvalidSequenceError': return new errors_1.InvalidSequenceError(log); case '/std.UnauthorizedError': return new errors_1.UnauthorizedError(log); case '/std.InsufficientFundsError': return new errors_1.InsufficientFundsError(log); case '/std.UnknownRequestError': return new errors_1.UnknownRequestError(log); case '/std.InvalidAddressError': return new errors_1.InvalidAddressError(log); case '/std.UnknownAddressError': return new errors_1.UnknownAddressError(log); case '/std.InvalidPubKeyError': return new errors_1.InvalidPubKeyError(log); case '/std.InsufficientCoinsError': return new errors_1.InsufficientCoinsError(log); case '/std.InvalidCoinsError': return new errors_1.InvalidCoinsError(log); case '/std.InvalidGasWantedError': return new errors_1.InvalidGasWantedError(log); case '/std.OutOfGasError': return new errors_1.OutOfGasError(log); case '/std.MemoTooLargeError': return new errors_1.MemoTooLargeError(log); case '/std.InsufficientFeeError': return new errors_1.InsufficientFeeError(log); case '/std.TooManySignaturesError': return new errors_1.TooManySignaturesError(log); case '/std.NoSignaturesError': return new errors_1.NoSignaturesError(log); case '/std.GasOverflowError': return new errors_1.GasOverflowError(log); default: return new errors_1.TM2Error("unknown error: ".concat(errorID), log); } }; exports.constructRequestError = constructRequestError;