Skip to content

Commit

Permalink
fix(error): Display for Error shows better info
Browse files Browse the repository at this point in the history
Displays the inner error for Error types with inner errors instead of
just displaying the description.

Closes hyperium#694
  • Loading branch information
DarinM223 committed Jun 18, 2016
1 parent 1088ef8 commit bc3c2eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ impl fmt::Debug for Void {

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(self.description())
match *self {
Uri(ref e) => fmt::Display::fmt(e, f),
Io(ref e) => fmt::Display::fmt(e, f),
Ssl(ref e) => fmt::Display::fmt(e, f),
Utf8(ref e) => fmt::Display::fmt(e, f),
ref e => f.write_str(e.description()),
}
}
}

Expand Down

0 comments on commit bc3c2eb

Please sign in to comment.