catch not handled in android

Issue

when signInWithEmailAndPassword fails exceptions are not handled and a red screen is shown.
(on IOS work as expected)

try {
await firebase.auth.signInWithEmailAndPassword(email, password);
}
catch(e) {
console.log(e); // NOT GETTING HERE
}

instead I get this:

image

Project Files

Javascript

Click To Expand

package.json:

“@react-native-firebase/app”: “^6.3.4”,
“@react-native-firebase/auth”: “^6.3.4”,

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I’m not using Pods
  • I’m using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A

Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you’re experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you’re using that has this issue:
    • 6.3.4
  • Firebase module(s) you’re using that has the issue:
    • auth
  • Are you using TypeScript?
    • Yes & 3.7.5

Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

2 thoughts on “catch not handled in android

  1. Looks like this method calls console.error with the error, which interrupts the app and is not a catchable exception, rather than throwing the error. I’m looking into fixing this, thanks!

    Edit: it’s probably throwing an error at a native level, which can also not be caught.

  2. I get this on react-native 0.62.2, react-native-firebase/auth 8.1.1. Code below does not catch the error:

       auth()
          .signInWithEmailAndPassword(email, pass)
          .then(() => {
            console.log("User with email '" + email + "' logged in!");
          })
          .catch((error) => {
            console.log(error);
    
            //console.error(error);
          });
    

    image

catch not handled in android

Issue

when signInWithEmailAndPassword fails exceptions are not handled and a red screen is shown.
(on IOS work as expected)

try {
await firebase.auth.signInWithEmailAndPassword(email, password);
}
catch(e) {
console.log(e); // NOT GETTING HERE
}

instead I get this:

image

Project Files

Javascript

Click To Expand

package.json:

“@react-native-firebase/app”: “^6.3.4”,
“@react-native-firebase/auth”: “^6.3.4”,

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I’m not using Pods
  • I’m using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A

Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you’re experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you’re using that has this issue:
    • 6.3.4
  • Firebase module(s) you’re using that has the issue:
    • auth
  • Are you using TypeScript?
    • Yes & 3.7.5

Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

2 thoughts on “catch not handled in android

  1. Looks like this method calls console.error with the error, which interrupts the app and is not a catchable exception, rather than throwing the error. I’m looking into fixing this, thanks!

    Edit: it’s probably throwing an error at a native level, which can also not be caught.

  2. I get this on react-native 0.62.2, react-native-firebase/auth 8.1.1. Code below does not catch the error:

       auth()
          .signInWithEmailAndPassword(email, pass)
          .then(() => {
            console.log("User with email '" + email + "' logged in!");
          })
          .catch((error) => {
            console.log(error);
    
            //console.error(error);
          });
    

    image