use std::{
error::Error,
fmt::{Display, Formatter, Result},
};
#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Debug)]
pub enum DataError {
EarlyEOF,
SourceFormat(String),
}
impl Display for DataError {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::SourceFormat(s) => f.write_fmt(format_args!("Source format error: {}", s)),
Self::EarlyEOF => "early EOF found".fmt(f),
}
}
}
impl Error for DataError {}
#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Copy, Debug)]
pub struct InvalidPSRError;
impl Display for InvalidPSRError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
"PSR value is not valid".fmt(f)
}
}
impl Error for InvalidPSRError {}
#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Debug)]
pub struct APIRequestError(pub String);
impl Display for APIRequestError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
match self {
Self(s) => f.write_fmt(format_args!("illegal parameter: {}", s)),
}
}
}
impl Error for APIRequestError {}