aeat.domain.iva._errors module

Domain errors for the aeat.domain.iva subpackage.

Every failure mode raised by the IVA substrate inherits from IvaError, which in turn inherits from aeat.core.errors.AeatError. Downstream callers catch the base class when they want to treat the substrate as an opaque unit, or the specific subclass when they need to distinguish missing-rate from missing-category or corpus load failures.

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

Bases: AeatError

Base error for every aeat.domain.iva failure mode.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError

Raised when aeat.domain.iva.lookup_rate() cannot resolve a rate.

The lookup fails either because the requested member state is absent from aeat.domain.iva.IVA_RATE_TABLE, because no rate of the requested aeat.domain.iva.IvaRateKind is registered for that member state, or because every registered rate’s effective window excludes the requested date.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError

Raised when a lookup against a resolved IVA catalogue misses.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError

Raised when a IVA catalogue cannot be loaded, resolved, or validated.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError

Raised when two aeat.domain.iva.IvaRateRecord records share a window.

The substrate enforces that for every (member_state, kind) partition of aeat.domain.iva.IVA_RATE_TABLE no two records have overlapping effective_from / effective_until ranges. Adding a new record that violates this invariant raises this error at module import time so the regression surfaces in CI rather than silently affecting aeat.domain.iva.lookup_rate() results.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError

Raised when aeat.domain.iva.classify_iva() cannot return a deterministic match.

The classifier exposes a closed first-match-wins table; the only structural failure is when the input criteria cannot be represented under the closed enum set, which is caught at construction time by pydantic. This error is reserved for future extensions such as ambiguous rule rankings.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError, ValueError

Raised on invalid IVA field values. Inherits from ValueError for Pydantic.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: IvaError

Base error for IVA prorrata calculation failures (LIVA arts. 101-103).

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: ProrrataError, ValueError

Raised when prorrata inputs violate domain invariants.

Inherits from ValueError so pydantic surfaces it as a ValidationError when raised from a model validator.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: ProrrataError

Raised when sectoral-separation inputs are inconsistent.

Examples: a sector references an unknown id, two sectors share an activity code, or the sector list is empty when sectoral separation is required (LIVA art. 9.1.c).

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]