Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pretty-error

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-error

Readable errors for node

  • 0.1.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
decreased by-7.95%
Maintainers
1
Weekly downloads
 
Created

What is pretty-error?

The pretty-error npm package is used to render error messages in a more visually appealing and readable format in Node.js applications. It transforms error stack traces into a more structured and stylized output, which can help developers to more easily identify the source and context of an error.

What are pretty-error's main functionalities?

Customizing the appearance of errors

This feature allows developers to customize the appearance of the error output by appending styles to the default configuration.

const PrettyError = require('pretty-error');
const pe = new PrettyError();
pe.appendStyle({
  'pretty-error > header > title > kind': {
    display: 'none'
  },
  'pretty-error > header > colon': {
    display: 'none'
  }
});
console.log(pe.render(new Error('Something went wrong!')));

Start using pretty-error with default settings

This code sample demonstrates how to use pretty-error with its default settings to render a more readable error message.

const PrettyError = require('pretty-error');
const pe = new PrettyError();
console.log(pe.render(new Error('Something went wrong!')));

Skipping packages and paths in the stack trace

This feature allows developers to skip certain packages or paths when rendering the error stack trace, making it easier to focus on the relevant parts of the trace.

const PrettyError = require('pretty-error');
const pe = new PrettyError();
pe.skipPackage('express', 'mongoose');
pe.skipPath('/home/user/node_modules/');
console.log(pe.render(new Error('Something went wrong!')));

Other packages similar to pretty-error

FAQs

Package last updated on 17 Feb 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc