Skip to main content

sim_lib_operation_gate/
operation_error.rs

1use sim_lib_journal::JournalError;
2use thiserror::Error;
3
4/// Typed refusal from durable operation construction, replay, or publication.
5#[derive(Debug, Error)]
6pub enum OperationError {
7    /// An operation name cannot be empty.
8    #[error("operation name is empty")]
9    EmptyOperation,
10    /// A supplied value was not the canonical value claimed by its identity.
11    #[error("noncanonical {0}")]
12    NonCanonical(&'static str),
13    /// The same claimed operation identity carried different intent.
14    #[error("contradictory intent under one operation id")]
15    ContradictoryIntent,
16    /// A grant did not belong to the stable operation.
17    #[error("operation grant does not match intent")]
18    GrantMismatch,
19    /// An attempt did not belong to the stable operation.
20    #[error("operation attempt does not match intent")]
21    AttemptMismatch,
22    /// Durable replay contained a second intent for one operation.
23    #[error("durable operation contains duplicate intent")]
24    DuplicateIntent,
25    /// A durable event violated the operation state order.
26    #[error("invalid durable operation transition: {0}")]
27    InvalidTransition(&'static str),
28    /// The service has no live fenced writer lease.
29    #[error("operation service must be explicitly resumed")]
30    NotResumed,
31    /// The journal sequence cannot be extended.
32    #[error("operation journal sequence is exhausted")]
33    SequenceExhausted,
34    /// The underlying canonical journal refused the operation.
35    #[error(transparent)]
36    Journal(#[from] JournalError),
37}