简体   繁体   中英

React Native error logging with firebase Crashlytics - How to get javascript stack trace

I have a React native application with configured using react native firebase lib and added the module of Crashlytics . Everything works okay but when i try to log an error using recordError() method or when i just use crash() its just logs errors in the dashboard in native form. I tried to find a way of getting js error to the dashboard but so far nothing has worked.


Is this possible or i should try a different way? maybe another platform like bugsnag or sentry?

This is working for me and showing javascript stacktrace :

....
catch (error) {
    crashlytics().recordError(new Error(error));
}

you can use react-native-exception-handler to get a js stack trace for the crash and also send js stack trace to firebase crashlytics

like this

import {getJSExceptionHandler} from 'react-native-exception-handler';


setJSExceptionHandler((error, isFatal) => {
  if(isFatal)
  {
  crashlytics().recordError(new Error(error));
  }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM