use context_error::ErrorKind;
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum CVError {
CacheDoesNotExist,
CacheCouldNotBeOpenend,
CacheCouldNotBeMade,
CacheCouldNotBeParsed,
#[default]
FileDoesNotExist,
FileCouldNotBeMade,
FileCouldNotBeOpenend,
FileCouldNotBeMoved,
FileCouldNotBeParsed,
CVUrlNotSet,
CVUrlCouldNotBeRead,
MissingReader,
ItemError,
ItemWarning,
}
impl ErrorKind for CVError {
type Settings = ();
fn descriptor(&self) -> &'static str {
if *self == Self::ItemWarning {
"warning"
} else {
"error"
}
}
fn ignored(&self, _settings: Self::Settings) -> bool {
false
}
fn is_error(&self, _settings: Self::Settings) -> bool {
*self != Self::ItemWarning
}
}