aeat.adapters.outbound.aeat.auth._errors module¶
Shared exception taxonomy for outbound AEAT authentication.
Every class here inherits from AeatError, 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,
adapters.outbound.aeat.auth.AeatSession for successful live
sessions, and adapters.outbound.aeat.auth.AeatLoginAssertion
for verification outcomes that can be returned without raising.
- exception AuthError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AeatErrorBase class for every outbound AEAT authentication domain error.
Catch this at adapter or CLI boundaries that need one AEAT-auth arm while preserving concrete subclasses such as
AuthConfigurationError,AeatLoginAssertionError, andAeatSessionExpiredErrorfor more specific handling.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception AuthConfigurationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AuthErrorRaised 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.ClaveMovilConfigurationErrorkeep their own public identity while remaining catchable through this shared configuration arm.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception AuthValidationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AuthError,ValueErrorRaised when authentication parameters or field values fail domain validation.
This error inherits from both
AuthErrorandValueError, ensuring compatibility with Pydantic’s validator contract while remaining catchable under the package’s unified error hierarchy. Certificate health and field-validation helpers use this class when invalid values should behave like validation failures and still carry auth-domain error metadata.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception AeatLoginAssertionError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AuthErrorRaised when an AEAT login assertion cannot be produced or trusted.
Providers raise this when a structural precondition blocks
adapters.outbound.aeat.auth.AeatLoginAssertioncreation, when a fresh login probe is invalid, or when persisted session metadata cannot be resumed safely. Call sites preservetranslated_messageso CLI and locale renderers can surface the specific refusal key without parsing the human-readable message.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception AeatSessionExpiredError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AuthErrorRaised when an authenticated AEAT session is no longer usable.
Conditions feeding this error include an
adapters.outbound.aeat.auth.AeatSessionidle 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:
- Return type:
None
- code: ClassVar[ErrorCode]¶