#[derive(Debug, thiserror::Error)]
pub enum ParseError {
    #[error("failed to read file: {0}")]
    Io(#[from] std::io::Error),
    #[error("failed to parse YAML: {0}")]
    Yaml(#[from] serde_yaml::Error),
}

#[derive(Debug, thiserror::Error)]
pub enum ValidationError {
    #[error("step '{step}' in job '{job}' has neither task nor command")]
    EmptyStep { job: String, step: String },
    #[error("dependency error: {0}")]
    Dependency(#[from] DependencyError),
}

#[derive(Debug, thiserror::Error)]
pub enum DependencyError {
    #[error("job '{job}' depends_on '{dependency}' which does not exist")]
    UnknownReference { job: String, dependency: String },
    #[error("circular dependency detected: {chain}")]
    CircularDependency { chain: String },
}
