You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
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
Version published
Weekly downloads
3.4M
-12.16%
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

promise

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