cadrumo.adapters.outbound.aeat.auth.errors module

Shared exception taxonomy for outbound AEAT authentication.

Every class here inherits from CadrumoError, so the core error registry binds a stable ErrorCode and locale message key to the public auth failure surface. Certificate and Cl@ve Móvil providers raise these errors with translated_message keys when a provider precondition, verification probe, persisted-session check, or configuration guard refuses to continue.

See also

adapters.outbound.aeat.auth for the public auth surface, AeatSession for successful live sessions, and AeatLoginAssertion for verification outcomes that can be returned without raising.

exception AuthConfigurationError(message=None, *, context=None, translated_message=None)[source]

Bases: AuthError

Raised when required authentication settings are missing or malformed.

This covers provider selection and configuration refusals before browser or certificate work begins. Provider-specific subclasses such as adapters.outbound.aeat.auth.clave_movil_support.ClaveMovilConfigurationError keep their own public identity while remaining catchable through this shared configuration arm.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception AuthProviderCleanupError(message=None, *, context=None, translated_message=None)[source]

Bases: AuthError

Raised when an auth provider retains browser resources after close.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception AuthValidationError(message=None, *, context=None, translated_message=None)[source]

Bases: AuthError

Raised when authentication parameters or field values fail domain validation.

Auth helpers raise the registered type directly. Any future Pydantic callback that needs this refusal must translate it to a plain ValueError at that callback boundary rather than adding a builtin base here.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception AeatSessionExpiredError(message=None, *, context=None, translated_message=None)[source]

Bases: AuthError

Raised when an authenticated AEAT session is no longer usable.

Conditions feeding this error include an AeatSession idle deadline that has elapsed, a failed single-shot reauthentication attempt, or an HTTP 401/403 surfaced by a downstream live-read call site. The registered error code is retryable so operator flows can prompt for a fresh authentication attempt.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code