Sentry do not logging JS exceptions
lucasluca opened this issue · 1 comments
lucasluca commented
After i configured the react-native-exception-handler, in my index.js, my Sentry lib stopped tracking erros, anyone could help me?
Thanks!
nacho-carnicero commented
Hey @lucasluca as explained here in the docs lots of external trackers are based on global exception handlers, and Sentry is not an exception.
I think the easiest way for you to be able to use both libraries in parallel would be to include the captureException
function from Sentry into the exception handler you are defining, something like this:
import { setJSExceptionHandler } from "react-native-exception-handler";
import * as Sentry from "@sentry/react-native";
const errorHandler = (error, isFatal) => {
// Log error to Sentry
Sentry.captureException(error);
// Do any other stuff here below
};
setJSExceptionHandler(errorHandler);
I haven't tested if it works but I am already catching some exceptions in my code with that function and it works fine, so I don't see any reason for which this won't work