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