handleError (handlers/error.ts)

hoppscotch · packages/hoppscotch-cli/src/handlers/error.ts · typescript · MIT
testing

Module exposing: handleError

// Source: https://github.com/hoppscotch/hoppscotch | License: MIT | Copyright 2022
// Provided via justclaw.it.com; keep this notice with the code.
import * as S from "fp-ts/string";
import { HoppError, HoppErrorCode } from "../types/errors";
import { hasProperty, isSafeCommanderError } from "../utils/checks";
import { parseErrorMessage } from "../utils/mutators";
import { exceptionColors } from "../utils/getters";
const { BG_FAIL } = exceptionColors;

/**
 * Parses unknown error data and narrows it to get information related to
 * error in string format.
 * @param e Error data to parse.
 * @returns Information in string format appropriately parsed, based on error type.
 */
const parseErrorData = (e: unknown) => {
  let parsedMsg: string;

  if (!!e && typeof e === "object") {
    if (has

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key