react-native-exception-handler icon indicating copy to clipboard operation
react-native-exception-handler copied to clipboard

setNativeExceptionHandler call back not working

Open shubhampareek-netsmartz opened this issue 5 years ago • 7 comments
trafficstars

I am using setNativeExceptionHandler and when app crash call back not triggering. I am using below code in index file.

setNativeExceptionHandler((errorString) => {
  console.log('setNativeExceptionHandler');
  fetch('http://localhost:3000/logvalues').then(res => res.json())
    .then(res => {
       
    }).catch(e => {
       
    })

}, false);

Neither console nor fetch api is working after crash. I am stuck in this.

Any help would be appreciated.

shubhampareek-netsmartz avatar Jan 06 '20 08:01 shubhampareek-netsmartz

same issues

youngjuning avatar Jan 08 '20 08:01 youngjuning

me too

hyc8801 avatar Jan 10 '20 07:01 hyc8801

setNativeExceptionHandler only works in bundle mode is that the case ?

anthowm avatar Jan 24 '20 06:01 anthowm

Does not work in dev and prod builds.

bartoszboruta avatar Jan 30 '20 12:01 bartoszboruta

ios works fine, but android doesn't work

any solution here?

davorbuha avatar Feb 03 '20 08:02 davorbuha

+1

gdoudeng avatar Apr 17 '21 03:04 gdoudeng

For anyone still interested, I hacked the library's code to use

Thread currentThread = Thread.currentThread();
currentThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {

instead of

Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {

and it now appears to be calling that block of code on the Java side.

eitherother avatar May 11 '22 20:05 eitherother