From 29bbc905969324da8afee6cb8eff1aeda34851c3 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 7 Jul 2021 12:22:12 +0100 Subject: [PATCH 1/2] #417 Added additional error logging to front end handle_request function. An ERROR will now be logged before the error response is sent to the client. Issue #417. Signed-off-by: Matt Davis --- CONTRIBUTORS.md | 1 + src/front/front_end.rs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a3f97350..c3cf26ac 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,3 +16,4 @@ This file aims to acknowledge the specific contributors referred to in the "Cont * Patrick Uiterwijk (@puiterwijk) * Nicolas Stalder (@nickray) * Edmund Grimley Evans (@egrimley-arm) +* Matt Davis (@MattDavis00) diff --git a/src/front/front_end.rs b/src/front/front_end.rs index 7679f5b7..165dc566 100644 --- a/src/front/front_end.rs +++ b/src/front/front_end.rs @@ -38,8 +38,8 @@ impl FrontEndHandler { /// Unmarshalls a request from the stream, passes it to the dispatcher and marshalls /// the response back onto the stream. /// - /// If an error occurs during (un)marshalling, no operation will be performed and the - /// method will return. + /// If an error occurs during (un)marshalling; no operation will be performed, an error will be logged + /// and the method will return. pub fn handle_request(&self, mut connection: Connection) { trace!("handle_request ingress"); // Read bytes from stream @@ -50,6 +50,9 @@ impl FrontEndHandler { format_error!("Failed to read request", status); let response = Response::from_status(status); + if response.header.status != ResponseStatus::Success { + format_error!("Sending back an error", response.header.status); + } if let Err(status) = response.write_to_stream(&mut connection.stream) { format_error!("Failed to write response", status); } From f039b22da79aa84ed89c9cb09d5ffb6b81ee3a7a Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 7 Jul 2021 15:03:47 +0100 Subject: [PATCH 2/2] Fixed whitespace issue causing CI fail Signed-off-by: Matt Davis --- src/front/front_end.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/front/front_end.rs b/src/front/front_end.rs index 165dc566..078c0ed3 100644 --- a/src/front/front_end.rs +++ b/src/front/front_end.rs @@ -51,7 +51,7 @@ impl FrontEndHandler { let response = Response::from_status(status); if response.header.status != ResponseStatus::Success { - format_error!("Sending back an error", response.header.status); + format_error!("Sending back an error", response.header.status); } if let Err(status) = response.write_to_stream(&mut connection.stream) { format_error!("Failed to write response", status);