aeat.domain.fincas._errors module

Domain errors for the rental register.

Every subclass is registered in aeat.core.errors._registry._DECLARED_ERROR_CODES so the __init_subclass__ hook on core.errors.AeatError can bind a stable core.errors.ErrorCode.

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

Bases: AeatError

Base error for the rental-register subpackage.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: FincaRegisterError

Raised when a referenced finca id is not present in the register.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: FincaRegisterError

Raised when a referenced rental contract id is not present in the register.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: FincaRegisterError

Raised when contract metadata is inconsistent and a tier cannot be resolved.

Examples: tenant_min_age > tenant_max_age, qualifying_co_tenant_count > tenant_count (also enforced at DB level), or a tier-90-a candidate with no prior-contract data.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: FincaRegisterError

Raised in strict mode when cumulative amortización would exceed the cap.

Default compute_amortization_for_year clamps to the remaining cap and never raises. Strict callers (e.g. preflight verifiers that want to flag the surface) opt in via strict=True.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: FincaRegisterError

Raised when the rental register cannot produce coherent aggregates.

Surface causes: contract referencing a non-existent finca; income record without a contract; ledger entry whose cumulative_amortization_through_year is out of order with surrounding entries (re-stated mid-year accrual without a prior recompute).

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

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

Bases: FincaRegisterError, ValueError

Raised when rental records violate state or shape invariants.

Inherits from ValueError to maintain compatibility 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]