From a2628357fd73bf01cef2f2e6326d132153214e3f Mon Sep 17 00:00:00 2001 From: Olivia Lee Date: Sat, 14 Dec 2024 02:23:46 -0800 Subject: [PATCH] show source chain in error response message Error messages in logs should generally be similar to the messages in the response body now. There's a bit of a concern with the source chain leaking sensitive information, but the errors that had a source were generally already logging the second error in the chain in their own Display impl, so if this is a problem it's unlikely to be a regression. --- src/utils/error.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/error.rs b/src/utils/error.rs index d855d737..53593f73 100644 --- a/src/utils/error.rs +++ b/src/utils/error.rs @@ -9,6 +9,7 @@ use ruma::{ OwnedServerName, }; use thiserror::Error; +use wee_woo::ErrorExt; use crate::{observability::prelude::*, Ra}; @@ -117,7 +118,7 @@ impl Error { return Ra(UiaaResponse::MatrixError(error)); } - let message = format!("{self}"); + let message = format!("{}", self.display_with_sources(" -> ")); let (kind, status_code) = match self { Self::BadRequest(kind, _) => (