lit_firebase_auth icon indicating copy to clipboard operation
lit_firebase_auth copied to clipboard

Uncaught email-already-in-use exception

Open reesealanj opened this issue 4 years ago • 3 comments

I'm not sure where in the lit_firebase_auth this error is coming from (I've been looking for the last 2 hours trying to find the cause), but on version 0.3.0 running a call to context.registerWithEmailAndPassword() returns the following error, and Wrapping my call to context.registerWithEmailAndPassword() does not work because the exception is uncaught by the actual call to FirebaseAuth within the back end of the package. I'm not sure what else to try or if I'm missing something here.

Error:

[VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: [firebase_auth/email-already-in-use] The email address is already in use by another account.
#0      catchPlatformException (package:firebase_auth_platform_interface/src/method_channel/utils/exception.dart:20:3)
#1      _rootRunUnary (dart:async/zone.dart:1198:47)
#2      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#3      _FutureListener.handleError (dart:async/future_impl.dart:160:20)
#4      Future._propagateToListeners.handleError (dart:async/future_impl.dart:708:47)
#5      Future._propagateToListeners (dart:async/future_impl.dart:729:24)
#6      Future._completeError (dart:async/future_impl.dart:537:5)
#7      _AsyncAwaitCompleter.completeError (dart:async-patch/async_patch.dart:47:15)
#8      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart)
<asynchronous suspension>
#9      MethodChannelFirebaseAuth.createUserWithEmailAndPassword (package:firebase_auth_platform_interface/src/method_channel/method_c<…>

The exception here is not unrecoverable in that I can simply just return from my registration widget to the sign in widget and the application continues to behave as expected. The only reason this is actually an issue is that because the uncaught exception doesn't make it out to the try catch block that I have the call wrapped in, the call will make my signInForm just spin endlessly and the `context.isSubmitting()` is never updated so the UI never updates to show that the call has failed and so that I can handle the error.

reesealanj avatar Dec 27 '20 19:12 reesealanj

Do you have some example code so that I can replicate? I'll also take a look at the exception logic.

funwithflutter avatar Jan 28 '21 01:01 funwithflutter

@funwithflutter Basically it seems you just forgot to update _registerWithEmailAndPassword https://github.com/funwithflutter/lit_firebase_auth/blob/2b15ba84a8c01829b2754d5e73bee82df71f6b9b/lib/src/infrastructure/firebase_auth_facade.dart#L88 with updating error handling commit refactor: update error handling with new core https://github.com/funwithflutter/lit_firebase_auth/commit/2b15ba84a8c01829b2754d5e73bee82df71f6b9b

orsenkucher avatar Aug 20 '21 12:08 orsenkucher

@funwithflutter will you have time to merge the https://github.com/funwithflutter/lit_firebase_auth/pull/38 fix?

orsenkucher avatar Aug 20 '21 13:08 orsenkucher