Coverage Summary for Class: AuthError (com.georgeci.moneysurfer.domain.auth)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| AuthError |
100%
(1/1)
|
|
100%
(3/3)
|
100%
(19/19)
|
| AuthError$Type |
100%
(1/1)
|
|
100%
(7/7)
|
100%
(48/48)
|
| Total |
100%
(2/2)
|
|
100%
(10/10)
|
100%
(67/67)
|
package com.georgeci.moneysurfer.domain.auth
/**
* Single typed failure for the auth-flow `Either`s. The data layer classifies provider-specific
* exceptions (e.g. FirebaseAuth subtypes) into [Type] at the boundary so domain use cases and the
* UI never need to know about Firebase types.
*/
data class AuthError(
val type: Type,
val message: String? = null,
val cause: Throwable? = null,
) {
enum class Type {
InvalidCredentials,
EmailAlreadyInUse,
/**
* The provider rejected the address itself (`ERROR_INVALID_EMAIL`). Distinct from
* [InvalidCredentials]: during sign-up there is nothing to "not match", so reporting it
* as wrong-email-or-password would be actively misleading.
*/
InvalidEmail,
WeakPassword,
/**
* Firestore rules denied a read or write that the bootstrap relies on
* (typically `users/{uid}` or `workspaces/{wid}`). Hard failure — there
* is no recovery the UI can drive other than telling the user to retry
* after the rules / membership are corrected.
*/
PermissionDenied,
/**
* The provider refused a destructive call (account deletion) because the session's
* last sign-in is too old — a fresh re-authentication is required first.
*/
RequiresRecentLogin,
Unknown,
}
}