New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

prettier_errors

Package Overview
Dependencies
Maintainers
1
Versions
1
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

prettier_errors

Prettify errors in console

unpublished
latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Prettier Errors

Example 1

Example 2

Example 3

Example 3

A tiny, lightweight, and experimental npm library which prettifies javascript errors and warnings! The module can work with:

  • All built-in runtime errors
  • Custom errors from other libraries
  • Promise rejections
  • Warnings

But, the library will not handle, and even make these worse:

  • If an object that's not an error is thrown (throw "")
  • If a promise is rejected and not caught with something that's not an error as the reason (reject(""))

Install

npm i prettier_errors

Usage

Setup the library

// At the top of your main file:
const settings = {
    proximity: 0, // How much lines to include in the error other than the main line
    stack_depth: 0, // How much of the stack to be shown in the error
    skip_empty_lines: false // Skip empty lines when showing the error, more compact but less readable, only matters when 'proximity' is more than 0.
};

// The first parameter tells the library which errors to prettify
// true - All errors
// false - Only errors which extend "PrettyError"s
require("prettyerrors").setup(true, settings);

Throw a pretty error

const {PrettyError} = require("prettyerrors");

// Usually you should extend this class
throw new PrettyError("This is a simple prettified error");

Keywords

console

FAQs

Package last updated on 20 Jun 2021

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