use crate::error::{Error, ErrorKind};
pub(super) fn unparsed(error: &config_rs::ConfigError) -> Error {
let rendered = error.to_string();
let first = rendered.lines().next().unwrap_or_default();
Error::new(ErrorKind::Parse, crate::loader::redacted(first))
}
pub(super) fn unfolded(error: &config_rs::ConfigError) -> Error {
let reason = match error {
config_rs::ConfigError::PathParse { .. } => "a key is not a path this engine can read",
config_rs::ConfigError::Frozen => "the configuration is frozen",
_ => "the resolution engine refused the layers it was given",
};
Error::new(ErrorKind::Backend, reason)
}