New React Native program error management library
Inspired by: react-native-exception-handler
npm install react-native-exc
or
yarn add react-native-exc
$ cd ios
$ pod install
No further steps should be taken
import { setJSExceptionHandler, setNativeExceptionHandler } from 'react-native-exc';
const errorHandler = (e: any, isFatal: any) => {
if (isFatal) {
Alert.alert(
'Unexpected error occurred',
`
Error: ${isFatal ? 'Fatal:' : ''} ${e.name} ${e.message}
We will need to restart the app.
`,
[
{
text: 'Restart',
onPress: () => {
console.log('restart');
},
},
]
);
} else {
console.log(e); // So that we can see it in the ADB logs in case of Android if needed
}
};
setJSExceptionHandler(errorHandler);
//...
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
MRB