From a1d2ea2db87ca8f37875fe6fb693cf25993b6e6e Mon Sep 17 00:00:00 2001 From: null Date: Wed, 1 Jul 2026 01:50:27 -0500 Subject: [PATCH] feat(auth): typed PasswordResetException sealed class --- .../repository/PasswordResetException.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/src/main/java/app/closer/domain/repository/PasswordResetException.kt diff --git a/app/src/main/java/app/closer/domain/repository/PasswordResetException.kt b/app/src/main/java/app/closer/domain/repository/PasswordResetException.kt new file mode 100644 index 00000000..658f456e --- /dev/null +++ b/app/src/main/java/app/closer/domain/repository/PasswordResetException.kt @@ -0,0 +1,18 @@ +package app.closer.domain.repository + +/** + * Typed reasons a "forgot password" request can't complete, mapped from Firebase specifics at the auth + * data-source boundary. Using these instead of matching on Firebase's human-readable error strings keeps + * detection robust across SDK/locale changes; the UI layer owns the user-facing copy per type. + * + * Note: under Firebase email-enumeration protection (enabled on this project), a reset for an unknown or + * Google-only address returns success — so [NoAccount] is only surfaced if that protection is disabled. + * The Google-only case is handled by enumeration-safe copy in the UI rather than a provider lookup. + */ +sealed class PasswordResetException(message: String) : Exception(message) { + /** No account exists for the given email (only reachable when email-enumeration protection is off). */ + class NoAccount : PasswordResetException("No account for email") + + /** The email address is malformed (a pure format check; always applies). */ + class InvalidEmail : PasswordResetException("Malformed email") +}