Awesome
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)
}
})