feat(wfe-core): add models, traits, and error types
Core domain models: WorkflowInstance, ExecutionPointer, WorkflowDefinition, WorkflowStep, Event, EventSubscription, ScheduledCommand, ExecutionError, LifecycleEvent, PollEndpointConfig. All serde-serializable. Provider traits: PersistenceProvider (composite of WorkflowRepository, EventRepository, SubscriptionRepository, ScheduledCommandRepository), DistributedLockProvider, QueueProvider, SearchIndex, LifecyclePublisher, WorkflowMiddleware, StepMiddleware, WorkflowRegistry. StepBody trait with StepExecutionContext for workflow step implementations. WorkflowData marker trait (blanket impl for Serialize + DeserializeOwned).
This commit is contained in:
39
wfe-core/src/error.rs
Normal file
39
wfe-core/src/error.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WfeError {
|
||||
#[error("Workflow not found: {0}")]
|
||||
WorkflowNotFound(String),
|
||||
|
||||
#[error("Workflow definition not found: {id} v{version}")]
|
||||
DefinitionNotFound { id: String, version: u32 },
|
||||
|
||||
#[error("Event not found: {0}")]
|
||||
EventNotFound(String),
|
||||
|
||||
#[error("Subscription not found: {0}")]
|
||||
SubscriptionNotFound(String),
|
||||
|
||||
#[error("Step not found: {0}")]
|
||||
StepNotFound(usize),
|
||||
|
||||
#[error("Lock acquisition failed for: {0}")]
|
||||
LockFailed(String),
|
||||
|
||||
#[error("Persistence error: {0}")]
|
||||
Persistence(String),
|
||||
|
||||
#[error("Serialization error: {0}")]
|
||||
Serialization(#[from] serde_json::Error),
|
||||
|
||||
#[error("Step execution error: {0}")]
|
||||
StepExecution(String),
|
||||
|
||||
#[error("Workflow cancelled")]
|
||||
Cancelled,
|
||||
|
||||
#[error(transparent)]
|
||||
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, WfeError>;
|
||||
Reference in New Issue
Block a user