Skip to main content

wfe_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4/// Wfeerror.
5pub enum WfeError {
6    #[error("Workflow not found: {0}")]
7    /// Workflownotfound.
8    WorkflowNotFound(String),
9
10    #[error("Workflow definition not found: {id} v{version}")]
11    /// Definitionnotfound.
12    DefinitionNotFound { id: String, version: u32 },
13
14    #[error("Event not found: {0}")]
15    /// Eventnotfound.
16    EventNotFound(String),
17
18    #[error("Subscription not found: {0}")]
19    /// Subscriptionnotfound.
20    SubscriptionNotFound(String),
21
22    #[error("Step not found: {0}")]
23    /// Stepnotfound.
24    StepNotFound(usize),
25
26    #[error("Lock acquisition failed for: {0}")]
27    /// Lockfailed.
28    LockFailed(String),
29
30    #[error("Persistence error: {0}")]
31    /// Persistence.
32    Persistence(String),
33
34    #[error("Serialization error: {0}")]
35    /// Serialization.
36    Serialization(#[from] serde_json::Error),
37
38    #[error("Step execution error: {0}")]
39    /// Stepexecution.
40    StepExecution(String),
41
42    #[error("Workflow cancelled")]
43    /// Cancelled.
44    Cancelled,
45
46    #[error(transparent)]
47    /// Other.
48    Other(#[from] Box<dyn std::error::Error + Send + Sync>),
49}
50
51/// Result.
52pub type Result<T> = std::result::Result<T, WfeError>;