aeat.domain.contribuyente._errors module

Domain errors for the contribuyente tax-residence profile.

Defines TaxResidenceProfileError and its concrete failures surfaced to RENTA verification, plus ProfileKeysRegistrationError for the profile-key registry. The ledger error hierarchies live with their records in domain.contribuyente.assets (asset) and domain.contribuyente.inventory (inventory and amortizacion). Every class derives from core.errors.AeatError so the shared error-code registration hook applies.

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

Bases: AeatError

Base class for tax-residence profile failures.

Concrete subclasses (ProfileNotConfiguredError, ForalRegimeError) carry their own translated messages and suggestions; this base type exists only so callers can catch the family with a single except clause.

Parameters:
  • message (str | None)

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

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
exception ProfileNotConfiguredError[source]

Bases: TaxResidenceProfileError

Raised when RENTA verification needs a tax-residence profile.

Attached to a suggestion pointing the operator at the profile edit wizard.

Return type:

None

code: ClassVar[ErrorCode]
exception ForalRegimeError(value)[source]

Bases: TaxResidenceProfileError

Raised when the user selects a foral regime not modelled by this profile.

Variables:

value – The foral CCAA identifier supplied by the caller.

Parameters:

value (str)

Return type:

None

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

Bases: TaxResidenceProfileError, ValueError

Raised when profile 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]
exception ProfileKeysRegistrationError(message='profile keys already registered with a different tuple')[source]

Bases: CoreError

Raised on a profile-key registry invariant violation.

Two cases share this typed exception (registered once centrally): a second registration with a conflicting tuple (the registry is single-writer, first registration wins), or an access before any registration — a programming / import-order error meaning the wizard catalogue (application.wizard) was not imported at startup to push the compiled keys via register_profile_keys(). Replaces a bare RuntimeError so callers can catch it precisely and the failure surfaces in the central registry.

Parameters:

message (str)

Return type:

None

code: ClassVar[ErrorCode]