use std::path::PathBuf;
#[derive(Debug)]
pub enum ConfigError {
IoOpen {
path: PathBuf,
err: String,
},
Parse {
line: usize,
col: usize,
msg: String,
},
Schema {
line: usize,
field: String,
msg: String,
},
}
impl std::fmt::Display for ConfigError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::IoOpen { path, err } => {
write!(f, "kevy-config: cannot read {}: {err}", path.display())
}
Self::Parse { line, col, msg } => {
write!(f, "kevy-config: parse error at line {line} col {col}: {msg}")
}
Self::Schema { line, field, msg } => {
write!(f, "kevy-config: schema error at line {line} on {field}: {msg}")
}
}
}
}
impl std::error::Error for ConfigError {}