Source code for cadrumo.application.ledger.evidence_errors
"""Typed refusals for the purchase invoice evidence surface.These live apart from the evidence records and their CRUD service because theinference package raises and catches them while holding no repository handleof its own. ``evidence`` reaches:class:`~cadrumo.adapters.persistence.storage.attachment.AttachmentStore` and the bucketevent history, so importing a refusal from there pulled the whole persistencesubtree into every consumer that only needed the exception type -- includingthe outbound LLM adapter, whose distance from persistence is what the operator'sin-memory inference exemption rests on.This module therefore imports no persistence, and must keep it that way: itsonly dependencies are the shared error base and the ledger precondition mixin,neither of which reaches an adapter."""from__future__importannotationsfrom...core.errors.hierarchyimportCadrumoErrorfrom.preconditionsimportLedgerPreconditionErrorMixin__all__=["PurchaseInvoiceEvidenceInputError","PurchaseInvoiceEvidenceNotFoundError","PurchaseInvoiceEvidenceReaderError",]
[docs]classPurchaseInvoiceEvidenceInputError(LedgerPreconditionErrorMixin,CadrumoError):"""Raised when a CLI-supplied evidence input violates the typed contract."""
[docs]classPurchaseInvoiceEvidenceReaderError(PurchaseInvoiceEvidenceInputError):"""Raised when the reader, not the document, is why a read did not happen. A subclass because every caller that catches an evidence-input refusal must keep catching this one, and a distinct class because the two say opposite things to an operator: an input refusal asks them to correct what they supplied, while this one says the document was fine and the reader was absent or answered unusably. It is RETRYABLE for the same reason -- the same command run again against a reachable reader is the remedy. """
[docs]classPurchaseInvoiceEvidenceNotFoundError(LedgerPreconditionErrorMixin,CadrumoError):"""Raised when a CLI lookup targets a missing evidence record."""