#[derive(Debug, thiserror::Error)]
pub enum WorkflowError {
#[error("stage '{0}' failed: {1}")]
StageFailed(String, String),
#[error("edge condition unsatisfied: {0} -> {1}")]
EdgeConditionFailed(String, String),
#[error("compensation failed at stage '{0}': {1}")]
CompensationFailed(String, String),
#[error("workflow verification failed: {0}")]
VerificationFailed(String),
#[error("stage not found: '{0}'")]
StageNotFound(String),
#[error("no start stage defined")]
NoStartStage,
#[error("agent error: {0}")]
Agent(#[from] car_multi::MultiError),
#[error("cycle limit reached after {0} iterations")]
CycleLimitReached(u32),
#[error("stage '{0}' timed out after {1}ms")]
Timeout(String, u64),
#[error("invalid resume: {0}")]
InvalidResume(String),
#[error("invalid approval input: {0}")]
InvalidApprovalInput(String),
#[error("approval gates inside sub-workflows are not yet supported (stage '{0}')")]
ApprovalInSubWorkflow(String),
}