From c4b817ae0bc1aca4651a3172922a922da61b6c15 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 7 Oct 2016 23:37:29 -0700 Subject: [PATCH] Cleanup dispatch messages and comments. --- lib/src/rocket.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/rocket.rs b/lib/src/rocket.rs index 1136578d..8a8ada17 100644 --- a/lib/src/rocket.rs +++ b/lib/src/rocket.rs @@ -91,7 +91,7 @@ impl Rocket { let outcome = responder.respond(res); info_!("{} {}", White.paint("Outcome:"), outcome); - // Get the result if we failed forward so we can try again. + // Check if the responder wants to forward to a catcher. match outcome { Outcome::Forward((c, r)) => return self.handle_error(c, &request, r), Outcome::Success | Outcome::Failure => return, @@ -128,16 +128,18 @@ impl Rocket { code: StatusCode, req: &'r Request, response: FreshHyperResponse) { - error_!("dispatch failed: {}.", code); + error_!("Dispatch failed: {}.", code); let catcher = self.catchers.get(&code.to_u16()).unwrap(); if let Some(mut responder) = catcher.handle(Error::NoRoute, req).responder() { if responder.respond(response) != Outcome::Success { - error_!("catcher outcome was unsuccessul; aborting response"); + error_!("Catcher outcome was unsuccessul; aborting response."); + } else { + info_!("Responded with catcher."); } } else { - error_!("catcher returned an incomplete response"); - warn_!("using default error response"); + error_!("Catcher returned an incomplete response."); + warn_!("Using default error response."); let catcher = self.default_catchers.get(&code.to_u16()).unwrap(); let responder = catcher.handle(Error::Internal, req).responder(); responder.unwrap().respond(response).expect_success()