When using Raven in ReactNative, any error that is thrown outside of a try-catch
block is not captured. It looks like there was an attempt to capture by calling ErrorUtils.setGlobalHandler
. Unfortunately, in production the errors are never captured because the app crashes before the request is complete.
One option is to skip the defaultHandler
, which is what causes the app to crash. However, the best behaviour is application-specific.
Perhaps the best solution is to avoid attempting calling ErrorUtils.setGlobalHandler
at all in the React Native plugin, and instead to provide documentation for users to do it themselves?
I have the same problem, in production no errors are logged.
I don't understand your workaround to get this working.
@Kerumen . Sorry. My description was a suggestion for how to fix the library, rather than a workaround for users, which is why it was confusing.
To understand how to change the behaviour yourself, I'd recommend reading through this library's React Native plugin: https://github.com/getsentry/raven-js/blob/master/plugins/react-native.js#L59 . You'll see where it calls ErrorUtils.setGlobalHandler
and passes the error along to Raven.captureException
. You can override this in your own code, and avoid calling defaultHandler.apply
. Then the error will be reported, but the app won't crash.
To _restart_ the app when there is an error, I used CodePush
which already has a utility CodePush.reloadApp
. If you aren't using CodePush
you'll likely be able to reimplement that functionality, or find a library to do it for you.
Thanks. I still have some troubles with CodePush and Sentry.
Can you help me? I reached you on Twitter :) Thanks!
This will likely be addressed by #626
Hey,
Check out our official client for react-native -> https://github.com/getsentry/react-native-sentry
Closing this here since it's obsolete.
If you're still having troubles, please create an issue there.
Thanks
Most helpful comment
Hey,
Check out our official client for react-native -> https://github.com/getsentry/react-native-sentry
Closing this here since it's obsolete.
If you're still having troubles, please create an issue there.
Thanks