Socket
Socket
Sign inDemoInstall

loud-rejection

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


Version published
Weekly downloads
3.5M
increased by0.04%
Maintainers
1
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 18 Feb 2016

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