Skip to content

Commit 0819601

Browse files
author
Devdutt Shenoi
committed
add error info to log
1 parent a889332 commit 0819601

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/handlers/http/middleware.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,14 @@ where
195195

196196
// Capture status_code and error information from response
197197
match &res {
198-
Ok(res) => log_builder.response.status_code = res.status().as_u16(),
198+
Ok(res) => {
199+
let status = res.status();
200+
log_builder.response.status_code = status.as_u16();
201+
// Use error information from reponse object if an error
202+
if let Some(err) = res.response().error() {
203+
log_builder.set_response_error(err.to_string());
204+
}
205+
}
199206
Err(err) => log_builder.set_response_error(err.to_string()),
200207
}
201208

0 commit comments

Comments
 (0)