Repository navigation
refactor(embedded): replace boolean accessors with typed EmbeddedAuthError - #1079
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
| ) : EmbeddedAuthError { | ||
|
|
||
| public enum class Reason { | ||
| /** a plain step-forward continuation. */ |
There was a problem hiding this comment.
"invalid_identifier_or_code" "invalid_code" "authorization_pending" "slow_down" "invalid_identifier_or_password" enums that can come under insufficient authorization. do we need add all these?
There was a problem hiding this comment.
Not now. We can add when those scenarios come in the next milestones
Description
Refactors
EmbeddedAuthExceptionto classify failures through a single strongly-typedEmbeddedAuthErrorsealed interface (EmbeddedAuthException.error), replacing the eight booleanis*accessors and the top-levelnextActionsfield.What changed
EmbeddedAuthError— sealed interface, 10 variants:InsufficientAuthorization(nextActions)(data class) plus data objectsTooManyWrongOtpAttempts,ChallengeExpired,AccessDenied,TooManyAttempts,TooManyLogins,SessionExpired,Network,NoActiveSession,Unknown.EmbeddedAuthException— exposeserror; removed the 8is*accessors and movednextActionsontoInsufficientAuthorization(only the recoverable case carries next steps).embeddedAuthErrorAdapter()mapping(statusCode, code, description, cause)→EmbeddedAuthError. Allinvalid_grantmaps toSessionExpired(no phase split).updateSessionFromFailure) —InsufficientAuthorizationadopts the rotatedauth_session;Networkpreserves the session for an in-place retry; every other error clears it, forcing a freshauthorize(). (Token-exchange failures continue to leave the session intact viaAdvancingRequest, independent of this rule.)Checklist
await) parity covered