61 lines
1.5 KiB
Rust
61 lines
1.5 KiB
Rust
|
|
use thiserror::Error;
|
||
|
|
|
||
|
|
#[derive(Error, Debug)]
|
||
|
|
pub enum WorkflowError {
|
||
|
|
#[error("Workflow not found: {0}")]
|
||
|
|
WorkflowNotFound(String),
|
||
|
|
|
||
|
|
#[error("Configuration error: {0}")]
|
||
|
|
ConfigError(#[from] ConfigError),
|
||
|
|
|
||
|
|
#[error("Invalid state transition: {from:?} -> {to:?}")]
|
||
|
|
InvalidTransition { from: String, to: String },
|
||
|
|
|
||
|
|
#[error("No current stage available")]
|
||
|
|
NoCurrentStage,
|
||
|
|
|
||
|
|
#[error("No agents configured for stage")]
|
||
|
|
NoAgentsInStage,
|
||
|
|
|
||
|
|
#[error("Task not found: {0}")]
|
||
|
|
TaskNotFound(String),
|
||
|
|
|
||
|
|
#[error("Stage not waiting for approval")]
|
||
|
|
NotWaitingApproval,
|
||
|
|
|
||
|
|
#[error("Swarm coordination error: {0}")]
|
||
|
|
SwarmError(String),
|
||
|
|
|
||
|
|
#[error("NATS messaging error: {0}")]
|
||
|
|
NatsError(Box<dyn std::error::Error + Send + Sync>),
|
||
|
|
|
||
|
|
#[error("Knowledge graph error: {0}")]
|
||
|
|
KnowledgeGraphError(String),
|
||
|
|
|
||
|
|
#[error("Serialization error: {0}")]
|
||
|
|
SerializationError(#[from] serde_json::Error),
|
||
|
|
|
||
|
|
#[error("IO error: {0}")]
|
||
|
|
IoError(#[from] std::io::Error),
|
||
|
|
|
||
|
|
#[error("Artifact persistence failed: {0}")]
|
||
|
|
ArtifactError(String),
|
||
|
|
|
||
|
|
#[error("Internal error: {0}")]
|
||
|
|
Internal(String),
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Error, Debug)]
|
||
|
|
pub enum ConfigError {
|
||
|
|
#[error("Failed to read config file: {0}")]
|
||
|
|
IoError(#[from] std::io::Error),
|
||
|
|
|
||
|
|
#[error("Failed to parse TOML: {0}")]
|
||
|
|
Parse(#[from] toml::de::Error),
|
||
|
|
|
||
|
|
#[error("Invalid configuration: {0}")]
|
||
|
|
Invalid(String),
|
||
|
|
}
|
||
|
|
|
||
|
|
pub type Result<T> = std::result::Result<T, WorkflowError>;
|