react-native-promise-rejection-utils
v0.0.1
Published
Utils for global tracking of unhandled promise rejections
Downloads
73,353
Maintainers
Readme
react-native-promise-rejection-utils
Utils for global tracking of unhandled promise rejections.
Installation
$ npm i react-native-promise-rejection-utils
Usage
import {
getUnhandledPromiseRejectionTracker,
setUnhandledPromiseRejectionTracker,
} from 'react-native-promise-rejection-utils'
const prevTracker = getUnhandledPromiseRejectionTracker()
setUnhandledPromiseRejectionTracker((id, error) => {
console.warn('Unhandled promise rejection!', id, error)
if (prevTracker !== undefined) {
prevTracker(id, error)
}
})