Source code for aeat.adapters.persistence.storage.master_key._errors
"""Typed exception hierarchy for the master-key cluster.Each class carries structured payload so callers can render typeddiagnostics without re-parsing the message string. Every class inheritsfrom an appropriate base in :mod:`adapters.persistence.storage`and is bound to a declared :class:`core.errors.ErrorCode` row atimport time via the ``__init_subclass__`` hook."""from__future__importannotationsfrom..errorsimportSecretStoreError,StorageError
[docs]classMasterKeyReentrantError(SecretStoreError):"""Raised when a master-key provider context manager is entered re-entrantly. The provider is single-entry: a second ``__enter__`` call while an active session is already held is a programming error, not a recoverable runtime state. The caller must close the outer session before re-entering. """def__init__(self,provider_name:str)->None:super().__init__(context={"provider_name":provider_name},translated_message="errors.internal.internal_master_key_reentrant",)self.provider_name=provider_name
[docs]classMasterKeyTypeError(StorageError,TypeError):"""Raised when a master-key operation receives a value of the wrong type. Inherits from both :class:`StorageError` and :class:`TypeError` to remain compatible with callers that catch raw :class:`TypeError` while allowing the typed storage-error surface to propagate through domain boundaries. """