Reputation: 5990
I want to be able to see the errors that happen in production in my React Native app.
In my Cordova app I was doing something like
window.onerror = function (error, msg, line) {
Flurry.logError(...);
}
Is there a way to do something similar in React Native? I'm guessing I could start from ExceptionsManager.js but I was wondering if there was something in place already.
Upvotes: 2
Views: 921
Reputation: 5990
I found the ErrorUtils
class that has a setGlobalHandler
method.
if (__DEV__ === false) {
var ErrorUtils = require("ErrorUtils");
var Flurry = require("Flurry");
ErrorUtils.setGlobalHandler((error, isFatal) => {
Flurry.logError(error, isFatal);
});
}
Seems to be working fine but I'm not sure if I'm supposed to be using it or if it's meant to be private.
Upvotes: 2