Skip to content

Commit

Permalink
(cleanup) Use try macro
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreeve committed Jun 12, 2015
1 parent fce24bd commit 40a258b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,13 @@ impl BeforeMiddleware for Logger {

impl AfterMiddleware for Logger {
fn after(&self, req: &mut Request, res: Response) -> IronResult<Response> {
match self.log(req, &res) {
Ok(_) => Ok(res),
Err(log_err) => Err(log_err),
}
try!(self.log(req, &res));
Ok(res)
}

fn catch(&self, req: &mut Request, err: IronError) -> IronResult<Response> {
match self.log(req, &err.response) {
Ok(_) => Err(err),
Err(log_err) => Err(log_err),
}
try!(self.log(req, &err.response));
Err(err)
}
}

Expand Down

0 comments on commit 40a258b

Please sign in to comment.