aeat.domain.invoices._errors module

Domain exceptions for the invoice catalogue.

Defines the typed error hierarchy raised by aeat.domain.invoices. Every failure path inherits from InvoiceError so callers can catch the whole domain, while InvoiceCatalogueError and its subclasses narrow to catalogue-level faults (persistence, missing records, broken cross-catalogue links).

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

Bases: AeatError

Base error for every invoice-catalogue failure.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: InvoiceError

Raised when an invoice catalogue is invalid or inconsistent.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: InvoiceCatalogueError

Raised when invoice catalogue persistence cannot be completed.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: InvoiceCatalogueError

Raised when a catalogue lookup targets a missing invoice.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: InvoiceCatalogueError

Raised when a bidirectional invoice/transaction link cannot proceed.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
exception InvoiceLinkInconsistencyError(*, invoice_path, transactions_path, invoice_id, transaction_id, message)[source]

Bases: InvoiceLinkError

Raised when a bidirectional link leaves the two catalogues out of sync.

Carries both filesystem paths and both identifiers so an operator can manually reconcile the invoice and transaction catalogues.

Variables:
  • invoice_path – Path to the invoice catalogue file.

  • transactions_path – Path to the transaction catalogue file.

  • invoice_id – Invoice identifier involved in the failed link.

  • transaction_id – Transaction identifier involved in the failed link.

Parameters:
  • invoice_path (Path)

  • transactions_path (Path)

  • invoice_id (str)

  • transaction_id (str)

  • message (str)

Return type:

None

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

Bases: InvoiceError, CoreValidationError

Raised when invoice records violate state or shape invariants.

Inherits from CoreValidationError (which itself inherits from CoreError and ValueError) to participate in the shared CoreValidationError catch surface and remain compatible with pydantic validators.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]