From 05e80929fa27cdd2ccfb75667e4846e276fa6c70 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Wed, 16 Feb 2022 16:15:44 -0800 Subject: [PATCH] Make errors implement Debug+Display std::error::Error has the minimal requirement of describing errors with both of these traits, I think we should enforce it too. This will allow us to send the full callstack to CloudWatch when there is an error. Signed-off-by: David Calavera --- lambda-runtime/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lambda-runtime/src/lib.rs b/lambda-runtime/src/lib.rs index c7aeb89a..a5be8fd1 100644 --- a/lambda-runtime/src/lib.rs +++ b/lambda-runtime/src/lib.rs @@ -91,7 +91,7 @@ where where F: Service>, F::Future: Future>, - F::Error: fmt::Display, + F::Error: fmt::Debug + fmt::Display, A: for<'de> Deserialize<'de>, B: Serialize, { @@ -125,7 +125,7 @@ where .into_req() } Err(err) => { - error!("{}", err); // logs the error in CloudWatch + error!("{:?}", err); // logs the error in CloudWatch EventErrorRequest { request_id, diagnostic: Diagnostic { @@ -137,7 +137,7 @@ where } }, Err(err) => { - error!("{:?}", err); // inconsistent with other log record formats - to be reviewed + error!("{:?}", err); EventErrorRequest { request_id, diagnostic: Diagnostic { @@ -199,7 +199,7 @@ pub async fn run(handler: F) -> Result<(), Error> where F: Service>, F::Future: Future>, - F::Error: fmt::Display, + F::Error: fmt::Debug + fmt::Display, A: for<'de> Deserialize<'de>, B: Serialize, {