Skip to main content

aion_store/
error.rs

1//! `StoreError` taxonomy.
2
3use aion_core::WorkflowId;
4
5/// Errors returned by [`crate::ReadableEventStore`] and [`crate::EventStore`] implementations.
6#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
7pub enum StoreError {
8    /// The workflow history head did not match the caller's optimistic-concurrency guard.
9    #[error(
10        "sequence conflict (double-writer bug indicator): expected workflow head {expected}, found {found}"
11    )]
12    SequenceConflict {
13        /// Sequence number the caller expected to be the current workflow head.
14        expected: u64,
15        /// Sequence number currently stored as the workflow head.
16        found: u64,
17    },
18
19    /// Reserved for operations that target a must-exist workflow; read and query methods return
20    /// empty results, not `NotFound`, for absent workflows.
21    #[error("workflow {workflow_id} was not found")]
22    NotFound {
23        /// Workflow identifier targeted by the must-exist operation.
24        workflow_id: WorkflowId,
25    },
26
27    /// Backend-specific failure mapped into the store contract's closed error surface.
28    #[error("store backend error: {0}")]
29    Backend(String),
30
31    /// Serialization or deserialization failure while crossing the store boundary.
32    #[error("store serialization error: {0}")]
33    Serialization(String),
34}