react-native-exception-handler: Handling exceptions in Android release APK
Hello,
I am able to catch JS as well as Native exceptions in Debug APK. But the exceptions are not caught in Release APK. Can you please suggest I am missing anything? Here is my code:
import { AppRegistry, Alert } from 'react-native';
import App from './App';
import {setJSExceptionHandler, setNativeExceptionHandler} from 'react-native-exception-handler';
import RNRestart from 'react-native-restart';
const reporter = (error) => {
console.log(error);
};
const errorHandler = (e, isFatal) => {
if (isFatal) {
reporter(e);
Alert.alert(
'Unexpected error occurred',
'Error: ${(isFatal) ? 'Fatal:' : ''} ${e.name} ${e.message}Please close the app and start again!',
[{
text: 'Restart',
onPress: () => {
RNRestart.Restart();
}
}]
);
} else {
console.log(e);
}
};
setJSExceptionHandler(errorHandler, true);
setNativeExceptionHandler((errorString => {
console.log('Native exception !!!');
}), true);
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 15 (4 by maintainers)
Same case with me, I am trying to send data to server on a Native Exception, but that part is not executing. However, i have put console logs at the starting and end of the native exception handler and both statements are getting executed. Glad to give you more information, if you need
Can’t send data to server in
setNativeExceptionHandler
that caused byrn-test-exception-handler
module, but did insetJSExceptionHandler
that caused by undefined function call,The two exception makers are in two buttons onPress