Skip to content

Commit

Permalink
Merge pull request #464 from MattDavis00/feature-additional-logging
Browse files Browse the repository at this point in the history
#417 Added additional error logging to front end handle_request function.
  • Loading branch information
ionut-arm authored Jul 8, 2021
2 parents ae83555 + f039b22 commit e244c7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 5 additions & 2 deletions src/front/front_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit e244c7d

Please sign in to comment.