UNPKG

@mavrykdynamics/taquito

Version:

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

20 lines (19 loc) 767 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatErrorMessage = void 0; const taquito_http_utils_1 = require("@mavrykdynamics/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 taquito_http_utils_1.HttpResponseError(`Http error response: (${error.status}) ${newBody}`, error.status, error.statusText, newBody, error.url); } else { return error; } } exports.formatErrorMessage = formatErrorMessage;