firebaseAuthOnCacthError function
void
firebaseAuthOnCacthError(})
Implementation
void firebaseAuthOnCacthError(
FirebaseAuthException error, {
Function? weakPasswordOption,
Function? alreadyEmailExistOption,
Function? userNotFound,
Function? wrongPassword,
}) {
switch (error.code) {
case 'weak-password':
if (kDebugMode) print('The password provided is too weak.');
weakPasswordOption;
throw CustomFirebaseAuthException('The password provided is too weak.');
case 'email-already-in-use':
if (kDebugMode) print('The account already exists for that email.');
alreadyEmailExistOption;
throw CustomFirebaseAuthException('email-already-in-use');
case 'user-not-found':
if (kDebugMode) print('No user found for that email.');
userNotFound;
throw CustomFirebaseAuthException('No user found for that email.');
case 'wrong-password':
if (kDebugMode) print('Wrong password provided for that user.');
wrongPassword;
throw CustomFirebaseAuthException(
'Wrong password provided for that user.');
case 'requires-recent-login':
if (kDebugMode) {
print(
'The user must reauthenticate before this operation can be executed.');
}
throw CustomFirebaseAuthException(
'The user must reauthenticate before this operation can be executed.');
}
}