feat(auth): typed PasswordResetException sealed class

This commit is contained in:
null 2026-07-01 01:50:27 -05:00
parent 7aa72532b7
commit a1d2ea2db8
1 changed files with 18 additions and 0 deletions

View File

@ -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")
}