cadrumo.domain.modelos.errors module

Domain errors for AEAT modelo records and calculations.

ModeloValidationError is raised by ModeloCode and WorkUnit invariant checks; PensionReduccionError reports invalid fiscal-reduction inputs, and raise_catalogue_integrity_error() normalises repository integrity failures into typed ModeloError subclasses.

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

Bases: CadrumoError

Base error for the modelos subpackage.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception PensionReduccionError(message=None, *, context=None, translated_message=None)[source]

Bases: CoreValidationError

Raised when a pension reducción computation pre-condition is violated.

Covers the numeric guard checks for both the DT 12ª plan-de-pensiones capital rescate reducción and the Ley 44/2015 SAL/SLL reserva especial dotacion computation. Raises instead of a bare ValueError so the failure reaches the typed error registry with a stable error code and a structured context envelope.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception ModeloValidationError(message=None, *, context=None, translated_message=None)[source]

Bases: ModeloError

Raised when a modelo code violates shape invariants.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception ModeloExportError(message=None, *, context=None, translated_message=None)[source]

Bases: ModeloError

Base error for modelo-revision export failures (manifest, archive build).

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception ModeloExportManifestError(message=None, *, context=None, translated_message=None)[source]

Bases: ModeloExportError

Raised when a modelo export manifest cannot be built or validated.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception Modelo036LifecycleError(message=None, *, context=None, translated_message=None)[source]

Bases: ModeloError

Base error for the Modelo 036 lifecycle (alta / modificacion / baja).

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception Modelo036PriorAltaRequiredError(message=None, *, context=None, translated_message=None)[source]

Bases: Modelo036LifecycleError

Raised when modificacion or baja is requested without a prior alta.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
exception Modelo036TerminalStateError(message=None, *, context=None, translated_message=None)[source]

Bases: Modelo036LifecycleError

Raised when an operation is requested on a 036 record already in a terminal (baja) state.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
raise_catalogue_integrity_error(exc, *, error_cls, label, translated_message, logger)[source]

Log and re-raise a secure-object catalogue integrity failure as error_cls.

The modelo catalogue repositories share one recovery path when a stored envelope fails its classification / schema-version guard: log the "<label> catalogue integrity error" at error level and raise the repository’s typed ModeloError subclass carrying the secure_object_integrity reason and the originating exception’s type in its context, chained from exc.

Return type:

NoReturn

Parameters: