diff options
author | clarkzjw <[email protected]> | 2023-07-26 12:37:38 -0700 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-07-26 12:37:38 -0700 |
commit | af2f09ea4cbb97d3ee91e30bb58e85508989d63a (patch) | |
tree | 671ead9c450a0abf71efc00ba1f2966ae6e60e02 /fedi/live_federation/error.rs | |
parent | f847de64eb8f724fa512801b43a26522afff61ae (diff) | |
download | photo-af2f09ea4cbb97d3ee91e30bb58e85508989d63a.tar.gz |
add example from https://github.com/LemmyNet/activitypub-federation-rust
Diffstat (limited to 'fedi/live_federation/error.rs')
-rw-r--r-- | fedi/live_federation/error.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fedi/live_federation/error.rs b/fedi/live_federation/error.rs new file mode 100644 index 0000000..3ef1819 --- /dev/null +++ b/fedi/live_federation/error.rs | |||
@@ -0,0 +1,20 @@ | |||
1 | use std::fmt::{Display, Formatter}; | ||
2 | |||
3 | /// Necessary because of this issue: https://github.com/actix/actix-web/issues/1711 | ||
4 | #[derive(Debug)] | ||
5 | pub struct Error(pub(crate) anyhow::Error); | ||
6 | |||
7 | impl Display for Error { | ||
8 | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
9 | std::fmt::Display::fmt(&self.0, f) | ||
10 | } | ||
11 | } | ||
12 | |||
13 | impl<T> From<T> for Error | ||
14 | where | ||
15 | T: Into<anyhow::Error>, | ||
16 | { | ||
17 | fn from(t: T) -> Self { | ||
18 | Error(t.into()) | ||
19 | } | ||
20 | } | ||