capacitor-firebase
capacitor-firebase copied to clipboard
feat: improve error handling
Is your feature request related to a problem? Please describe:
Error messages are currently poorly described and have no unique, uniform error codes. This complicates cross-platform error handling.
Describe the solution you'd like:
The error messages should contain a helpful message and a unique code.
Describe alternatives you've considered:
No alternative solutions.
Additional context:
Hi
I hope we can have this feature soon.
My biggest problem for now is the message "An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address." I can't really find a way to distinguish between this error and all other ways "signIn failed". I think I really should tell my user what is the problem. "signIn failed" message only returns from this file: /android/src/main/java/dev/robingenz/capacitorjs/plugins/firebase/auth/FirebaseAuthentication.java
. I think it shouldn't be that hard to change this file to return a better more described message.
Do you think we can have this in any near future?
Thanks
Hi @pouriamoosavi, i was planning to implement this change in the next month or the month after. Unfortunately, this is not the only place where error messages can be thrown. When I implement this feature, I really want to trade as many errors as possible. In addition, not only Android but also iOS and Web are supported as platforms. Furthermore, the error messages should be the same across all platforms. So there are many points to consider that make this issue complex.
Any news ?
Not yet. I plan to release this feature with Capacitor 5.
Any news please ? Someone knows when capacitor is going to be released ?
Any news ?
Has someone tried to implement this lib: https://github.com/capacitor-community/facebook-login ? Instead of waiting patch
Any news about issue?
Hi @robingenz, thanks for the great work. Does the above update cover signInWithFacebook? if yes am still not getting a clear error message on android when using signInWithFacebook. On IOS it returns a clear error text but no error code.
Andriod Log
/FirebaseAuthentication: signInWithCredential failed. com.google.firebase.auth.FirebaseAuthUserCollisionException: An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address. at com.google.android.gms.internal.firebase-auth-api.zzxc.zzb(com.google.firebase:firebase-auth@@21.1.0:4) at com.google.android.gms.internal.firebase-auth-api.zzya.zza(com.google.firebase:firebase-auth@@21.1.0:7) at com.google.android.gms.internal.firebase-auth-api.zzyb.zzl(com.google.firebase:firebase-auth@@21.1.0:1) at com.google.android.gms.internal.firebase-auth-api.zzxy.zzq(com.google.firebase:firebase-auth@@21.1.0:3) at com.google.android.gms.internal.firebase-auth-api.zzxy.zze(com.google.firebase:firebase-auth@@21.1.0:1) at com.google.android.gms.internal.firebase-auth-api.zzxa.zze(com.google.firebase:firebase-auth@@21.1.0:1) at com.google.android.gms.internal.firebase-auth-api.zzvf.zzd(com.google.firebase:firebase-auth@@21.1.0:8) at com.google.android.gms.internal.firebase-auth-api.zzuy.zzb(com.google.firebase:firebase-auth@@21.1.0:3) at com.google.android.gms.internal.firebase-auth-api.zzyj.zzb(com.google.firebase:firebase-auth@@21.1.0:12) at com.google.android.gms.internal.firebase-auth-api.zzyj.zza(com.google.firebase:firebase-auth@@21.1.0:14) at com.google.android.gms.internal.firebase-auth-api.zzxp.zzq(com.google.firebase:firebase-auth@@21.1.0:4) at com.google.android.gms.internal.firebase-auth-api.zzvf.zzA(com.google.firebase:firebase-auth@@21.1.0:4) at com.google.android.gms.internal.firebase-auth-api.zzxb.zzu(com.google.firebase:firebase-auth@@21.1.0:5) at com.google.android.gms.internal.firebase-auth-api.zzwh.zzc(com.google.firebase:firebase-auth@@21.1.0:1) at com.google.android.gms.internal.firebase-auth-api.zzyc.run(com.google.firebase:firebase-auth@@21.1.0:1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) D/Capacitor: Sending plugin error: {"save":false,"callbackId":"43697152","pluginId":"FirebaseAuthentication","methodName":"signInWithFacebook","success":false,"error":{"message":"signIn failed."}}
IOS Log
"(no name)") ERROR MESSAGE: {"message":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","errorMessage":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address."} ⚡️ [error] - {"message":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","errorMessage":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address."}
Does the above update cover signInWithFacebook?
@Sdqumar Yes. Please create a new issue with a Minimal, Reproducible Example using this template in a public GitHub repository so I can take a closer look.