Source code for cadrumo.domain.filing.errors

"""Domain errors for the :mod:`domain.filing` subpackage.

Every exception inherits from :class:`~core.errors.hierarchy.CadrumoError` so
callers can catch the project-wide base.
"""

from __future__ import annotations

from ...core.errors.hierarchy import CadrumoError, CoreValidationError


[docs] class ModeloDraftError(CadrumoError): """Base class for every error raised inside :mod:`domain.filing`."""
[docs] class ModeloBuilderError(ModeloDraftError): """Raised when builder selection or execution fails."""
[docs] class FilingValidationError(ModeloDraftError, CoreValidationError): """Raised when a filing record is invalid. Two distinct callers raise it. :class:`ModeloValidator` never raises on its own — findings are returned — so this error is what a caller opting into ``fail_on_warning`` gets for a blocking finding on an otherwise well-formed draft. The schema models also raise it from their cross-field validators for a record that is structurally malformed: a provenance kind contradicting its own value, an identity that is not its own content address, or two identity Its registered ancestry includes :class:`~core.errors.hierarchy.CoreValidationError` under the filing error family. Pydantic model validators translate the registered failure to ``ValueError`` at their narrow boundary, yielding a :class:`pydantic.ValidationError` for structurally malformed records. """
[docs] class ModeloComputationError(ModeloDraftError): """Raised when a builder cannot evaluate a formula casilla."""
[docs] class ModeloImportError(ModeloDraftError): """Raised when importing a filing from a justificante PDF fails."""
[docs] class FilingExportError(ModeloDraftError): """Raised when exporting a draft to an AEAT wire format fails."""
[docs] class FilingExportValidationError(FilingExportError): """Raised on invalid export field values or layouts. Its canonical registered ancestry is :class:`FilingExportError`; any Pydantic export validator translates this registered failure to ``ValueError`` at its narrow boundary. """