use thiserror::Error;
#[derive(Error, Debug, Clone, PartialEq)]
pub enum Error {
#[error("Error during IO")]
Io {
message: String,
},
#[error("Error reading file '{path:?}'")]
File {
path: String,
},
#[error("Error wile parsing document")]
Parse,
#[error("Error including document at '{path:?}'")]
Include {
path: String,
},
#[error("Error processing deep includes")]
TooManyIncludes,
#[error("Error processing includes from a str source")]
IncludeNotAllowedFromStr,
#[error("Error including document with External URL as feature has been disabled")]
DisabledExternalUrl,
#[error("Error looking for key '{key:?}'")]
KeyNotFound {
key: String,
},
#[error("Error getting a value because key is not present")]
MissingKey,
#[error("Error getting a value because of an invalid key type")]
InvalidKey,
#[error("Error deserializing: {message:?}")]
Deserialization {
message: String,
},
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Error::Io {
message: e.to_string(),
}
}
}