unifiedErrorHandling function
Implementation
void unifiedErrorHandling(AuthService authService) async {
final errorHandler = AuthErrorHandler.withDefaults(
onError: (error) {
showErrorToast(error.message);
},
);
// Same error handler for all auth methods
try {
await authService.signInWithGoogle(errorHandler: errorHandler);
} catch (e) {
// Fallback to email/password
try {
await authService.signInWithEmailAndPassword(
email: 'user@example.com',
password: 'password',
errorHandler: errorHandler,
);
} catch (e) {
print('All login methods failed');
}
}
}