UNPKG

@dethcrypto/eth-sdk

Version:

🛠 Generate type-safe, lightweight SDK for your Ethereum smart contracts

19 lines • 745 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatError = void 0; const chalk_1 = require("chalk"); const makeError_1 = require("../utils/makeError"); /** * Colors the first line of error message red, and colors all links in following lines cyan. */ function formatError(error) { const { message } = (0, makeError_1.makeError)(error); const [firstLine, ...rest] = message.split('\n'); return [(0, chalk_1.red)(firstLine), ...rest.map(colorLinksCyan)].join('\n'); } exports.formatError = formatError; const URL_REGEX = /(https:\/\/[^\s]+)/g; function colorLinksCyan(str) { return str.replace(URL_REGEX, (match) => chalk_1.cyan.underline(match)); } //# sourceMappingURL=formatError.js.map