use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Error(pub(crate) String);
impl Error {
pub fn new(message: impl Into<String>) -> Self {
Self(message.into())
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.0)
}
}
impl std::error::Error for Error {}
impl From<std::io::Error> for Error {
fn from(value: std::io::Error) -> Self {
Self(value.to_string())
}
}
impl From<ureq::Error> for Error {
fn from(value: ureq::Error) -> Self {
Self(value.to_string())
}
}
impl From<serde_json::Error> for Error {
fn from(value: serde_json::Error) -> Self {
Self(value.to_string())
}
}
impl From<libloading::Error> for Error {
fn from(value: libloading::Error) -> Self {
Self(value.to_string())
}
}