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