no-unhandledrejection
v0.0.0
Published
Simple plugin to avoid unhandledrejection error
Readme
no-unhandledrejection

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 -SUsage
// 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.
