UNPKG

@taquito/taquito

Version:

High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.

20 lines 770 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatErrorMessage = void 0; const http_utils_1 = require("@taquito/http-utils"); function formatErrorMessage(error, stringToReplace) { const body = JSON.parse(error.body); if (body[0] && body[0].kind && body[0].msg) { const newBody = JSON.stringify({ kind: body[0].kind, id: body[0].id, msg: body[0].msg.replace(stringToReplace, ''), }); return new http_utils_1.HttpResponseError(`Http error response: (${error.status}) ${newBody}`, error.status, error.statusText, newBody, error.url); } else { return error; } } exports.formatErrorMessage = formatErrorMessage; //# sourceMappingURL=helper.js.map