Source code for aeat.application.aggregation._errors
"""Errors raised while handling aggregation and source-mesh boundaries.Raised by pure rollup modules such as :mod:`~._iva_ledger`,:mod:`~._renta_ledger`, :mod:`~._retenciones`, :mod:`~._counterpart`, and:mod:`~._foreign_assets`, and by source-mesh resolvers such as:mod:`~._modelo_bindings` and :mod:`~._oss_ioss`, when aggregation constraintsor resolver ownership contracts are violated."""from__future__importannotationsfromcollections.abcimportMappingfrom...core.errorsimportAeatError,CoreError,CoreValidationErrorfrom...core.i18nimportTranslatableastr
[docs]classAggregationConfigError(CoreError,ValueError):"""Raised when an aggregation service composition invariant is violated. Inherits from ``ValueError`` so pydantic field and model validators surface it through ``ValidationError`` without special handling. Inherits from ``CoreError`` so it participates in the central error registry and ``build_error_envelope``. """
[docs]classAggregationError(AeatError):"""Base class for financial transaction aggregation failures. The ``translated_message`` field is a translation key resolved by the internationalization system at runtime. The same key is also routed through the positional ``message=`` arg so ``str(exc)`` returns the key (rather than the empty string) for diagnostic surfaces, structured logs, and operator error envelopes that render exceptions via ``str``. Without this routing, every operator-facing display of an aggregation error showed the empty string. """def__init__(self,message:tr,*,context:Mapping[str,object]|None=None,suggestion:str|None=None,)->None:super().__init__(str(message),translated_message=message,context=context,suggestion=suggestion,)
[docs]classAggregationPeriodError(AggregationError):"""Raised when a requested filing period cannot be parsed unambiguously."""
[docs]classAggregationUnsupportedModeloError(AggregationError):"""Raised when no aggregation contract is available for the requested modelo."""
[docs]classAggregationMissingClassificationError(AggregationError):"""Raised when in-period transactions still need business classification."""
[docs]classAggregationCategoryCoverageError(AggregationError):"""Raised when a business transaction lacks category or profile coverage."""
[docs]classAggregationValidationError(AggregationError,CoreValidationError):"""Raised on invalid aggregation payload or state. Inherits from CoreValidationError (which itself inherits from CoreError and ValueError) to participate in the shared CoreValidationError catch surface and remain compatible with pydantic field validators. """
[docs]deft(message:str)->tr:"""Build a multilingual :class:`core.i18n.Translatable` message payload. Args: message: The translation key. Returns: A :class:`core.i18n.Translatable` marker for the key. """returntr(message)