use thiserror::Error;
#[derive(Debug, Clone)]
pub struct ContractMismatch {
pub field: String,
pub expected: String,
pub actual: String,
}
impl std::fmt::Display for ContractMismatch {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}: expected '{}', got '{}'",
self.field, self.expected, self.actual
)
}
}
#[derive(Debug, Error)]
pub enum DeploymentError {
#[error("failed to read {path}: {source}")]
ReadFile {
path: String,
#[source]
source: std::io::Error,
},
#[error("failed to write {path}: {source}")]
WriteFile {
path: String,
#[source]
source: std::io::Error,
},
#[error("failed to create directory {path}: {source}")]
CreateDir {
path: String,
#[source]
source: std::io::Error,
},
#[error("failed to parse YAML in {path}: {source}")]
ParseYaml {
path: String,
#[source]
source: serde_yaml_ng::Error,
},
#[error("file not found: {0}")]
NotFound(String),
}