aeat.adapters.inbound.sanitizer._errors module¶
Domain errors raised by the adapters.inbound.sanitizer subpackage.
All sanitiser errors inherit from
core.errors.AeatError so callers can catch the family
without importing implementation details. The hierarchy mirrors the
failure surfaces the sanitiser pipeline can encounter — source-parse
failure, signature-present refusal, already-sanitised guard, and
unhandled PII surfaces.
- exception SanitizationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AeatErrorBase error for the
adapters.inbound.sanitizersubpackage.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception SanitizerValidationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
SanitizationError,ValueErrorRaised when synthetic parameters or field values fail domain validation.
This error inherits from both
SanitizationErrorandValueError, ensuring compatibility with Pydantic’s validator contract while remaining catchable under the package’s unified error hierarchy.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception SanitizerSourceParseError(message=None, *, failure=None)[source]¶
Bases:
SanitizationErrorRaised when the source PDF cannot be opened by
pikepdf.The rendered message and structured context intentionally avoid source paths, provider payloads, and QPDF/pikepdf raw diagnostics. Callers that need to report the underlying parser failure should log only the exception type at the boundary that catches it.
- code: ClassVar[ErrorCode]¶
- exception SignaturePresentError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
SanitizationErrorRaised when the source PDF carries a digital signature.
Modifying a signed PDF silently invalidates the signature; the sanitiser refuses such inputs and requires the operator to escalate to human review.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception AlreadySanitizedError(*, source_sha256)[source]¶
Bases:
SanitizationErrorRaised when the source SHA-256 is already in
SANITIZED_SHAS.Prevents accidental “re-sanitise an already-committed fixture”. Callers can opt out via
sanitize_pdf(..., refuse_if_already_sanitized=False).- Parameters:
source_sha256 (str)
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception UnknownSurfaceError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
SanitizationErrorRaised when a PII surface is detected that the sanitiser does not handle.
Used for threat-model surfaces this version of the sanitiser is not yet wired to scrub (e.g. a future modelo introduces an
OCPropertiesshape we have not characterised). The default policy is fail; callers can downgrade to a warning by toggling the relevantdrop_*flag off and accepting the resulting warning.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶