Source code for cadrumo.adapters.outbound.aeat.auth.errors
"""Shared exception taxonomy for outbound AEAT authentication.Every class here inherits from :class:`~core.errors.hierarchy.CadrumoError`, so thecore error registry binds a stable :class:`~core.errors.error_codes.ErrorCode` andlocale message key to the public auth failure surface. Certificate and Cl@veMóvil providers raise these errors with ``translated_message`` keys when aprovider precondition, verification probe, persisted-session check, orconfiguration guard refuses to continue.See Also: :mod:`adapters.outbound.aeat.auth` for the public auth surface, :class:`~application.auth.session_types.AeatSession` for successful live sessions, and :class:`~application.auth.session_types.AeatLoginAssertion` for verification outcomes that can be returned without raising."""from__future__importannotationsfrom.....core.errors.hierarchyimportAuthError
[docs]classAuthConfigurationError(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 :class:`adapters.outbound.aeat.auth.clave_movil_support.ClaveMovilConfigurationError` keep their own public identity while remaining catchable through this shared configuration arm. """
[docs]classAuthProviderCleanupError(AuthError):"""Raised when an auth provider retains browser resources after close."""
[docs]classAuthValidationError(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. """
[docs]classAeatSessionExpiredError(AuthError):"""Raised when an authenticated AEAT session is no longer usable. Conditions feeding this error include an :class:`~application.auth.session_types.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. """