🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@firanorg/alias-repellat-vero

Package Overview
Dependencies
Maintainers
0
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@firanorg/alias-repellat-vero

A little function that formats an error object as a nice, readable string. Works in node and the browser; in node, it will use [kleur](https://www.npmjs.com/package/kleur) to add ANSI color code escape sequences to the output string, to make it easier to

unpublished
latest
Source
npmnpm
Version
5.17.148
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

@firanorg/alias-repellat-vero

A little function that formats an error object as a nice, readable string. Works in node and the browser; in node, it will use kleur to add ANSI color code escape sequences to the output string, to make it easier to read.

Features

  • Works in both node and the browser
  • Browser version is only ~2k
  • Error name and stack are printed in color
  • Handles non-error inputs gracefully (accepts unknown in TypeScript)
  • Also prints any additional properties that were added to the Error object
    • This is particularly nice when working with node's fs errors; node sometimes puts the information about eg "which file couldn't be read" is sometimes in a property on the error, rather than in the error message, so by printing additional properties, it's guaranteed to be visible.

Example

Sample output of using @firanorg/alias-repellat-vero in the node repl. See the "Usage" section below for the code used in this screenshot.

Installation

npm install @firanorg/alias-repellat-vero

Usage

import { formatError } from "@firanorg/alias-repellat-vero";

const error = new Error("uh oh!");

error.context = {
  user: "jeff",
  session: "ewnj75hvj3v4tvmuy43er",
  favoriteIceCreamFlavor: "pineapple",
};

console.log(formatError(error));
/*
  Logs:

  Error: uh oh!
    at REPL2:1:9
  The above error also had these properties on it:
  {
    context: {
      user: 'jeff',
      session: 'ewnj75hvj3v4tvmuy43er',
      favoriteIceCreamFlavor: 'pineapple'
    }
  }
*/

License

MIT

Keywords

package manager

FAQs

Package last updated on 18 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts