aeat.adapters.inbound.borrador._errors module

Error hierarchy for the Modelo 100 borrador parser.

The hierarchy specialises PdfModeloImportError with Modelo 100 exceptions raised by adapters.inbound.borrador.parse_borrador(), the artefact detector, and coverage validation. It is an inbound parse-error boundary; callers should inspect the structured attributes on BorradorParseError rather than parsing rendered messages.

exception BorradorParseError(message=None, *, missing=(), malformed=(), ambiguous=(), coverage=None)[source]

Bases: PdfModeloImportError

Raised when a Modelo 100 PDF cannot be parsed into an observation record.

Base class for every borrador-specific failure raised by the inbound parser. Subclasses, such as ArtefactNotRecognisedError, refine the failure mode while preserving the PdfModeloImportError import-family contract.

When the error originates from an extraction-coverage failure the following structured attributes are populated so callers can assert on them without parsing the message string:

Variables:
  • missing – Tuple of casilla IDs that produced no hit in the PDF.

  • malformed – Tuple of casilla IDs whose captured value could not be parsed as a valid decimal or text token.

  • ambiguous – Tuple of casilla IDs that matched more than one region in the PDF.

  • coverage – Fraction of target casillas successfully extracted (Decimal). None when the error is not an extraction-coverage failure.

Parameters:
Return type:

None

code: ClassVar[ErrorCode]
exception ArtefactNotRecognisedError(message=None, *, missing=(), malformed=(), ambiguous=(), coverage=None)[source]

Bases: BorradorParseError

Raised when the PDF does not match any known Modelo 100 artefact shape.

Surfaced by detect_artefact_kind() when none of the BORRADOR / VISTA PREVIA / CSV markers can be located.

Parameters:
Return type:

None

code: ClassVar[ErrorCode]