a7ul / react-native-exception-handler

A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions.
MIT License
1.58k stars 133 forks source link

Not Working with crashlytics #157

Open BhavyaKoshiya opened 2 years ago

BhavyaKoshiya commented 2 years ago

@a7ul I am using this code in my App.js but the alert is not showing instead it shows unhandled promise rejection in Yellowbox


const errorHandler = (e, isFatal) => {
  if (isFatal) {
    Alert.alert(
      'Unexpected error occurred',
      `
        Error: ${isFatal ? 'Fatal:' : ''} ${e.name} ${e.message}
        We have reported this to our team ! Please close the app and start again!
        `,
      [
        {
          text: 'Close'
        }
      ]
    )
  } else {
    console.log(e) // So that we can see it in the ADB logs in case of Android if needed
  }
}

setJSExceptionHandler(errorHandler, true)

setNativeExceptionHandler((errorString) => {
  console.log('setNativeExceptionHandler')
})

These are my dependencies

"dependencies": {
    "@invertase/react-native-apple-authentication": "^2.1.5",
    "@react-native-async-storage/async-storage": "^1.15.13",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-cookies/cookies": "^6.0.11",
    "@react-native-firebase/analytics": "^13.0.1",
    "@react-native-firebase/app": "^13.0.1",
    "@react-native-firebase/auth": "^13.0.1",
    "@react-native-firebase/crashlytics": "^13.0.1",
    "@react-native-firebase/database": "^13.0.1",
    "@react-native-firebase/dynamic-links": "^13.0.1",
    "@react-native-firebase/in-app-messaging": "^13.0.1",
    "@react-native-firebase/messaging": "^13.0.1",
    "@react-native-firebase/perf": "^13.0.1",
    "@react-native-firebase/remote-config": "^13.0.1",
    "@react-native-google-signin/google-signin": "^7.0.1",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.5",
    "@stream-io/flat-list-mvcp": "^0.10.1",
    "d3-shape": "^2.1.0",
    "expo-barcode-scanner": "^10.2.2",
    "expo-camera": "^11.1.2",
    "expo-local-authentication": "11.1.1",
    "i18n-js": "^3.8.0",
    "lottie-ios": "3.2.3",
    "lottie-react-native": "^4.1.3",
    "mobx": "^6.3.6",
    "mobx-react": "^7.2.1",
    "moment": "^2.29.1",
    "numeral": "^2.0.6",
    "react": "17.0.2",
    "react-native": "0.66.3",
    "react-native-bidirectional-infinite-scroll": "^0.3.3",
    "react-native-countdown-component": "^2.7.1",
    "react-native-country-picker-modal": "^2.0.0",
    "react-native-device-info": "^8.4.5",
    "react-native-dropdown-picker": "^5.2.3",
    "react-native-exception-handler": "^2.10.10",
    "react-native-fast-image": "^8.5.11",
    "react-native-fbsdk-next": "^4.6.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^2.1.5",
    "react-native-logs": "^3.0.4",
    "react-native-looped-carousel": "^0.1.13",
    "react-native-modal": "^13.0.0",
    "react-native-nfc-manager": "^3.11.0",
    "react-native-orientation-locker": "^1.3.1",
    "react-native-qrcode-svg": "^6.1.1",
    "react-native-reanimated": "^2.2.4",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.9.0",
    "react-native-size-matters": "^0.4.0",
    "react-native-snap-carousel": "^4.0.0-beta.6",
    "react-native-svg": "^12.1.0",
    "react-native-svg-transformer": "^0.14.3",
    "react-native-swiper": "^1.6.0",
    "react-native-unimodules": "^0.14.10",
    "react-native-vector-icons": "^8.1.0",
    "react-native-walkthrough-tooltip": "^1.3.0",
    "react-native-webview": "^11.14.2",
    "throttle-debounce": "^3.0.1",
    "use-count-up": "^3.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.15.8",
    "@babel/plugin-proposal-class-properties": "^7.14.5",
    "@babel/plugin-proposal-decorators": "^7.15.8",
    "@babel/runtime": "^7.15.4",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-core": "^6.26.3",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.6.3",
    "babel-preset-airbnb": "^5.0.0",
    "babel-preset-react-native": "^4.0.1",
    "eslint": "^7.32.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-import": "^2.25.2",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^3.11.0",
    "eslint-watch": "^7.0.0",
    "jest": "^26.6.3",
    "lint-staged": "^11.2.6",
    "metro-react-native-babel-preset": "^0.66.2",
    "pre-commit": "^1.2.2",
    "prettier": "^2.4.1",
    "prettier-eslint": "^13.0.0",
    "react-native-svg-asset-plugin": "^0.5.0",
    "react-test-renderer": "17.0.2"
  }
bombillazo commented 2 years ago

Experiencing this issue as well.

LucasHimelfarb commented 2 years ago

Any solution?

karthikNAS commented 1 year ago

any updates on this issue?