Hide SpanTrace debug output from LemmyError

asonix/better-errors
Aode (lion) 2021-11-24 17:26:26 -06:00
parent 6a2871024d
commit 12d2a62e40
1 changed files with 10 additions and 1 deletions

View File

@ -48,7 +48,6 @@ struct ApiError {
error: String,
}
#[derive(Debug)]
pub struct LemmyError {
pub message: Option<String>,
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)?;