getting message of throw with invalid data

This commit is contained in:
José Salazar
2026-01-22 09:46:39 -05:00
parent 1b67bb21c8
commit beb3a36590

View File

@@ -39,8 +39,10 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
fallbackEmail: firebaseUser.email ?? email, fallbackEmail: firebaseUser.email ?? email,
); );
//TO-DO: validate that user is business role and has business account
} on firebase.FirebaseAuthException catch (e) { } on firebase.FirebaseAuthException catch (e) {
if (e.code == 'user-not-found' || e.code == 'wrong-password') { if (e.code == 'invalid-credential' || e.code == 'wrong-password') {
throw Exception('Incorrect email or password.'); throw Exception('Incorrect email or password.');
} else { } else {
throw Exception('Authentication error: ${e.message}'); throw Exception('Authentication error: ${e.message}');
@@ -94,7 +96,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
final newUserData = createUserResponse.data?.user_insert; final newUserData = createUserResponse.data?.user_insert;
if (newUserData == null) { if (newUserData == null) {
await firebaseUser.delete(); // Rollback if user profile creation fails await firebaseUser.delete(); // Rollback if user profile creation fails
// TODO: Also delete the created Business if this fails // TO-DO: Also delete the created Business if this fails
throw Exception('User profile creation failed after Firebase user registration.'); throw Exception('User profile creation failed after Firebase user registration.');
} }