use actix_web::ResponseError;
#[derive(Debug)]
pub struct CustomError {
err: anyhow::Error,
}
impl std::fmt::Display for CustomError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.err)
}
}
impl CustomError {
pub fn new(err: anyhow::Error) -> Self {
CustomError { err }
}
}
impl ResponseError for CustomError {}