diff --git a/examples/default/android/app/src/main/java/com/instabug/react/example/RNInstabugExampleCrashReportingModule.java b/examples/default/android/app/src/main/java/com/instabug/react/example/RNInstabugExampleCrashReportingModule.java index 4ccb7ad3c..d8fb6ace8 100644 --- a/examples/default/android/app/src/main/java/com/instabug/react/example/RNInstabugExampleCrashReportingModule.java +++ b/examples/default/android/app/src/main/java/com/instabug/react/example/RNInstabugExampleCrashReportingModule.java @@ -37,9 +37,18 @@ public void sendNativeNonFatal(final String exceptionObject) { @ReactMethod public void sendNativeFatalCrash() { - throw new IllegalStateException("Unhandled IllegalStateException from Instabug Test App"); + try { + throw new IllegalStateException("Unhandled IllegalStateException from Instabug Test App"); + } catch (IllegalStateException e) { + @ReactMethod + public void sendNativeFatalCrash() { + try { + throw new IllegalStateException("Unhandled IllegalStateException from Instabug Test App"); + } catch (IllegalStateException e) { + // Report the exception instead of crashing the app directly + CrashReporting.report(e); + } } - @ReactMethod public void sendANR() { sendHang(20000);