From 12d2a62e40bc873f3530c159a6feed584ae03ac8 Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Wed, 24 Nov 2021 17:26:26 -0600 Subject: [PATCH] Hide SpanTrace debug output from LemmyError --- crates/utils/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs index 9b88a15ec..e6188d2b8 100644 --- a/crates/utils/src/lib.rs +++ b/crates/utils/src/lib.rs @@ -48,7 +48,6 @@ struct ApiError { error: String, } -#[derive(Debug)] pub struct LemmyError { pub message: Option, pub inner: anyhow::Error, @@ -85,6 +84,16 @@ where } } +impl std::fmt::Debug for LemmyError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LemmyError") + .field("message", &self.message) + .field("inner", &self.inner) + .field("context", &"SpanTrace") + .finish() + } +} + impl Display for LemmyError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.inner.fmt(f)?;