use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum LoadError {
#[error("config: read {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("config: parse {path}: {source}")]
Yaml {
path: PathBuf,
#[source]
source: serde_yaml_ng::Error,
},
#[error("config: invalid {path} at {key}: {message}")]
Invalid {
path: PathBuf,
key: String,
message: String,
},
#[error("config: unresolved reference at {key}: {message}")]
UnresolvedRef { key: String, message: String },
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Warning {
pub file: PathBuf,
pub key: String,
pub message: String,
}
impl Warning {
pub fn new(
file: impl Into<PathBuf>,
key: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
file: file.into(),
key: key.into(),
message: message.into(),
}
}
}