Source code for cadrumo.application.operations.errors
"""Canonical application errors for supervised operations."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfrom...core.errors.hierarchyimportCoreValidationError,InternalInvariantErrorifTYPE_CHECKING:from.persistence.journalimportOperationPersistedSnapshot
[docs]classOperationDeclarationError(CoreValidationError):"""An executor attempted behavior outside its registered declaration."""
[docs]classOperationUnsettledError(InternalInvariantError):"""Supervised execution stopped without reaching a settlement it could commit. ``snapshot`` is the journal's state when the failure was observed; the stopping error is chained as the cause. The operation is left for owner recovery rather than settled with a claim the supervisor cannot prove. """def__init__(self,snapshot:OperationPersistedSnapshot)->None:"""Carry the durable state a waiter reads instead of a bare task failure."""super().__init__(translated_message="errors.internal.internal_operation_unsettled",context={"operation_id":snapshot.identity.operation_id,"lifecycle":snapshot.lifecycle.value,"revision":snapshot.revision,},)self.snapshot=snapshot