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

loud-rejection

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loud-rejection

Make unhandled promise rejections fail loudly instead of the default silent fail

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7M
increased by3.8%
Maintainers
2
Weekly downloads
 
Created

What is loud-rejection?

The loud-rejection npm package is designed to make unhandled promise rejections fail loudly instead of the default silent fail. It helps in debugging by logging the errors to the console.

What are loud-rejection's main functionalities?

Default handler for unhandled rejections

This feature sets up a default handler for unhandled promise rejections, which logs the stack trace to stderr.

const loudRejection = require('loud-rejection');
loudRejection();

new Promise((resolve, reject) => {
  reject(new Error('Unhandled rejection'));
});

Custom log function

This feature allows you to provide a custom log function to handle the unhandled rejections in a way that suits your needs.

const loudRejection = require('loud-rejection');
const customLogger = error => console.error('Custom log:', error);
loudRejection(customLogger);

new Promise((resolve, reject) => {
  reject(new Error('Unhandled rejection with custom logger'));
});

Other packages similar to loud-rejection

Keywords

FAQs

Package last updated on 28 Sep 2019

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