UNPKG

@taquito/taquito

Version:

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

19 lines (18 loc) 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatErrorMessage = formatErrorMessage; 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; } }