use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Error)]
pub enum Error {
#[error("Not enough data")]
NotEnoughData,
#[error("Unsupported operation")]
Unsupported,
#[error("Invalid character")]
InvalidChar,
#[error("{0}")]
Custom(String),
}
impl serde::de::Error for Error {
fn custom<T>(msg: T) -> Self
where
T: std::fmt::Display,
{
Self::Custom(msg.to_string())
}
}
impl serde::ser::Error for Error {
fn custom<T>(msg: T) -> Self
where
T: std::fmt::Display,
{
Self::Custom(msg.to_string())
}
}