aeat.domain.attachments._errors module

Domain exceptions for domain.attachments.

Every error raised inside the attachment subpackage inherits from AttachmentError, which itself derives from core.errors.AeatError. Callers can therefore catch the family root for coarse handling or branch on the specific subclasses.

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

Bases: AeatError

Base error for every attachment-service failure.

All other exceptions in domain.attachments derive from this class so callers can install a single catch.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
exception AttachmentValidationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: AttachmentError, ValueError

Raised when an attachment payload fails domain validation.

Used both by pydantic-driven validation on domain.attachments.Attachment and by adapters.persistence.storage.AttachmentStore when an untrusted digest token does not match the expected 64-character lowercase hex shape.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
exception AttachmentPersistenceError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: AttachmentError

Raised when the attachment store cannot read or write bytes or manifests.

Wraps the underlying OSError so callers do not have to reason about raw filesystem failures.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
exception AttachmentNotFoundError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: AttachmentError

Raised when a manifest or blob lookup targets a missing attachment.

Distinct from AttachmentPersistenceError so callers can treat a missing record differently from a filesystem failure.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]