-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/plugins
#775Labels
p: firebaseFirebase pluginsFirebase pluginspackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
Hi,
I just found out that if an error happens on the FirebaseAuth side like "email already used" I will only get an
throw new PlatformException(code: errorCode, message: errorMessage, details: errorDetails);with errorCode = "exception" and an error message that isn't localized which isn't really helpful.
Looking at the Java side of the plugin made it obvious
private class SignInCompleteListener implements OnCompleteListener<AuthResult> {
private final Result result;
SignInCompleteListener(Result result) {
this.result = result;
}
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Exception e = task.getException();
result.error(ERROR_REASON_EXCEPTION, e.getMessage(), null);
} else {
FirebaseUser user = task.getResult().getUser();
ImmutableMap<String, Object> userMap = mapFromUser(user);
result.success(userMap);
}
}
}
This should actually be a [FirebaseAuthException](https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuthException)
which has a `GetErrorCode` method. Please change that so that Apps can react on error conditions with their own texts.bizz84, riccardoratta, FViscardi and EriKWDev
Metadata
Metadata
Assignees
Labels
p: firebaseFirebase pluginsFirebase pluginspackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.