"""Domain exceptions for :mod:`domain.attachments`.Every error raised inside the attachment subpackage inherits from:exc:`AttachmentError`, which itself derives from:exc:`core.errors.AeatError`. Callers can therefore catch the familyroot for coarse handling or branch on the specific subclasses."""from__future__importannotationsfrom...core.errorsimportAeatError
[docs]classAttachmentError(AeatError):"""Base error for every attachment-service failure. All other exceptions in :mod:`domain.attachments` derive from this class so callers can install a single catch. """
[docs]classAttachmentValidationError(AttachmentError,ValueError):"""Raised when an attachment payload fails domain validation. Used both by pydantic-driven validation on :class:`domain.attachments.Attachment` and by :class:`adapters.persistence.storage.AttachmentStore` when an untrusted digest token does not match the expected 64-character lowercase hex shape. """
[docs]classAttachmentPersistenceError(AttachmentError):"""Raised when the attachment store cannot read or write bytes or manifests. Wraps the underlying :exc:`OSError` so callers do not have to reason about raw filesystem failures. """
[docs]classAttachmentNotFoundError(AttachmentError):"""Raised when a manifest or blob lookup targets a missing attachment. Distinct from :exc:`AttachmentPersistenceError` so callers can treat a missing record differently from a filesystem failure. """