use crate::error::GraphError;
#[derive(Debug, thiserror::Error)]
pub enum FunctionalError {
#[error("task '{task}' failed after {attempts} attempts: {message}")]
TaskFailed {
task: String,
attempts: u32,
message: String,
},
#[error("state validation failed for field '{field}': expected {expected}, got {actual}")]
SchemaValidation {
field: String,
expected: String,
actual: String,
},
#[error("interrupt resume type mismatch for task '{task}': {message}")]
InterruptTypeMismatch {
task: String,
message: String,
},
#[error("workflow cancelled")]
Cancelled,
#[error("checkpoint failed for task '{task}': {message}")]
CheckpointFailed {
task: String,
message: String,
},
#[error("run '{run_id}' timed out after {timeout_secs}s")]
RunTimeout {
run_id: String,
timeout_secs: u64,
},
#[error("invalid cron expression '{expression}': {reason}")]
InvalidCronExpression {
expression: String,
reason: String,
},
#[error("cron job '{job_id}' not found")]
CronJobNotFound {
job_id: String,
},
#[error("run '{run_id}' not found")]
RunNotFound {
run_id: String,
},
}
impl From<FunctionalError> for GraphError {
fn from(e: FunctionalError) -> Self {
GraphError::Other(e.to_string())
}
}