Skip to content

Commit 854ca9c

Browse files
authored
Make errors implement Debug+Display (#418)
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 <[email protected]>
1 parent bc9367b commit 854ca9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lambda-runtime/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ where
9191
where
9292
F: Service<LambdaEvent<A>>,
9393
F::Future: Future<Output = Result<B, F::Error>>,
94-
F::Error: fmt::Display,
94+
F::Error: fmt::Debug + fmt::Display,
9595
A: for<'de> Deserialize<'de>,
9696
B: Serialize,
9797
{
@@ -125,7 +125,7 @@ where
125125
.into_req()
126126
}
127127
Err(err) => {
128-
error!("{}", err); // logs the error in CloudWatch
128+
error!("{:?}", err); // logs the error in CloudWatch
129129
EventErrorRequest {
130130
request_id,
131131
diagnostic: Diagnostic {
@@ -137,7 +137,7 @@ where
137137
}
138138
},
139139
Err(err) => {
140-
error!("{:?}", err); // inconsistent with other log record formats - to be reviewed
140+
error!("{:?}", err);
141141
EventErrorRequest {
142142
request_id,
143143
diagnostic: Diagnostic {
@@ -199,7 +199,7 @@ pub async fn run<A, B, F>(handler: F) -> Result<(), Error>
199199
where
200200
F: Service<LambdaEvent<A>>,
201201
F::Future: Future<Output = Result<B, F::Error>>,
202-
F::Error: fmt::Display,
202+
F::Error: fmt::Debug + fmt::Display,
203203
A: for<'de> Deserialize<'de>,
204204
B: Serialize,
205205
{

0 commit comments

Comments
 (0)