mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2024-11-14 12:41:16 +00:00
23 lines
497 B
Rust
23 lines
497 B
Rust
use actix_web::ResponseError;
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
/// Necessary because of this issue: https://github.com/actix/actix-web/issues/1711
|
|
#[derive(Debug)]
|
|
pub struct Error(anyhow::Error);
|
|
|
|
impl ResponseError for Error {}
|
|
|
|
impl Display for Error {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
std::fmt::Display::fmt(&self.0, f)
|
|
}
|
|
}
|
|
|
|
impl<T> From<T> for Error
|
|
where
|
|
T: Into<anyhow::Error>,
|
|
{
|
|
fn from(t: T) -> Self {
|
|
Error(t.into())
|
|
}
|
|
}
|