aeat.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, suggestion=None, translated_message=None)[source]¶
Bases:
AeatErrorBase error for the modelos subpackage.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception PensionReduccionError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
CoreValidationErrorRaised 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
ValueErrorso the failure reaches the typed error registry with a stable error code and a structured context envelope.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception ModeloValidationError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
ModeloError,ValueErrorRaised when a modelo code violates shape invariants.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception ModeloExportError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
ModeloErrorBase error for modelo-revision export failures (manifest, archive build).
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception ModeloExportManifestError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
ModeloExportErrorRaised when a modelo export manifest cannot be built or validated.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception Modelo036LifecycleError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
ModeloErrorBase error for the Modelo 036 lifecycle (alta / modificacion / baja).
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception Modelo036PriorAltaRequiredError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
Modelo036LifecycleErrorRaised when modificacion or baja is requested without a prior alta.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception Modelo036TerminalStateError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
Modelo036LifecycleErrorRaised when an operation is requested on a 036 record already in a terminal (baja) state.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- exception CensoStaleRefusedError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
ModeloErrorRaised when an operation is refused because the censo was updated after the target was produced.
Applies to calculate, verify, file, build_draft, approve_draft, and export_draft. AEAT is the binding legal source of truth: any work unit, calculation revision, filing draft, or filing record that referenced censo facts now superseded by a
aeat config profile censo applymust be refused until the operator re-runs the governing calculation against the fresh censo. The fix is operator-driven: re-runaeat app modelo work calculate(or the relevant verb) against the affected work unit.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- 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 typedModeloErrorsubclass carrying thesecure_object_integrityreason and the originating exception’s type in its context, chained fromexc.