feat(auth): ChangePasswordException sealed class with typed failure reasons
This commit is contained in:
parent
2ecff95c12
commit
07eaf3c989
|
|
@ -0,0 +1,23 @@
|
|||
package app.closer.domain.repository
|
||||
|
||||
/**
|
||||
* Typed reasons a signed-in password change can fail, 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.
|
||||
*/
|
||||
sealed class ChangePasswordException(message: String) : Exception(message) {
|
||||
/** The current password entered for re-authentication was wrong. */
|
||||
class WrongCurrentPassword : ChangePasswordException("Current password incorrect")
|
||||
|
||||
/** The new password doesn't meet Firebase's strength requirement. */
|
||||
class WeakNewPassword : ChangePasswordException("New password too weak")
|
||||
|
||||
/** Firebase is throttling after too many attempts — back off and retry later. */
|
||||
class TooManyAttempts : ChangePasswordException("Too many attempts")
|
||||
|
||||
/** The session is too old; the user must sign in again before changing the password. */
|
||||
class ReauthRequired : ChangePasswordException("Recent sign-in required")
|
||||
|
||||
/** This account has no password to change (e.g. Google sign-in only). */
|
||||
class NoPassword : ChangePasswordException("Account has no password")
|
||||
}
|
||||
Loading…
Reference in New Issue