use core::fmt;
#[derive(Debug, Clone)]
pub struct Error {
pub details: String,
}
impl Error {
pub fn new(details: String) -> Self {
Self { details }
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.details)
}
}
impl std::error::Error for Error {
fn description(&self) -> &str {
&self.details
}
}
impl From<oauth2::url::ParseError> for Error {
fn from(error: oauth2::url::ParseError) -> Self {
Self::new(error.to_string())
}
}
impl From<jsonwebtoken::errors::Error> for Error {
fn from(error: jsonwebtoken::errors::Error) -> Self {
Self::new(error.to_string())
}
}
impl From<reqwest::Error> for Error {
fn from(error: reqwest::Error) -> Self {
Self::new(error.to_string())
}
}