Socket
Book a DemoInstallSign in
Socket

no-unhandledrejection

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

no-unhandledrejection

Simple plugin to avoid unhandledrejection error

0.0.0
latest
npmnpm
Version published
Maintainers
1
Created
Source

no-unhandledrejection Build Status npm package

Simple lightweight (379B gzip size) processing unhandledRejection error library prevents unhandledRejection from causing program crashes. The usage scenario is that not all async functions need to be try catch.

Install

$ npm i no-unhandledrejection -S

Usage

// Browser
import noUnhandledRejection from 'no-unhandledrejection'
noUnhandledRejection()

// Node
require('no-unhandledrejection')()

// With Sentry
require('no-unhandledrejection')({
  callback (e) {
    Raven.captureException(e)
  }
})

Options

onlyProduction

Type: Boolean Default: false

Enable this plugin only under the production mode (process.env.NODE_ENV === 'production').

callback

Type: Function Default: noop

A generic callback function that handles unhandledRejection. Usually used for reporting such as Error Tracking or global error notification.

License

Copyright (c) 2017-present, Army-U. Released under the MIT License.

FAQs

Package last updated on 14 May 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.