Source code for aeat.domain.manuals._errors

"""Domain errors for the :mod:`aeat.domain.manuals` subpackage.

Every exception raised by loading, verifying, fetching, or extracting
from the AEAT *Manual práctico* corpus inherits from
:class:`ManualError`, which in turn inherits from
:class:`aeat.core.errors.AeatError`.
"""

from __future__ import annotations

from ...core.errors import AeatError


[docs] class ManualError(AeatError): """Base error for every :mod:`aeat.domain.manuals` failure mode."""
[docs] class ManualNotFoundError(ManualError): """Raised when a requested manual/year/part is missing on disk."""
[docs] class ManualParseError(ManualError): """Raised when a committed manual record fails schema validation."""
[docs] class ManualReviewRequiredError(ManualError): """Raised when a persisted record lacks reviewer metadata. The verify CLI rejects any :class:`~aeat.domain.manuals.Manual`, :class:`~aeat.domain.manuals.Section`, or :class:`~aeat.domain.manuals.Rule` record missing ``definition_reviewed_by`` or ``definition_reviewed_at`` when the ``AEAT_MANUALS_REVIEW_REQUIRED`` setting is enabled. """
[docs] class RuleExtractionError(ManualError): """Raised by LLM-dependent CLI subcommands that have no backing implementation. The ``structure``, ``extract-rules``, and ``translate`` subcommands define their public CLI shape but raise this exception until the :mod:`aeat.adapters.outbound.llm` subpackage is available. """
[docs] class ManifestError(ManualError): """Raised when a ``manifest.json`` fails schema or sha256 checks."""
[docs] class ManualValidationError(ManualError, ValueError): """Raised when manual records violate state or shape invariants. Inherits from ValueError to maintain compatibility with Pydantic validators. """
__all__ = [ "ManifestError", "ManualError", "ManualNotFoundError", "ManualParseError", "ManualReviewRequiredError", "ManualValidationError", "RuleExtractionError", ]