feat(error): Display for Error shows better info

Displays the inner error for Error types with inner errors instead of
just displaying the description.

Closes #694
This commit is contained in:
Darin Minamoto
2016-06-18 12:27:13 -07:00
parent 1088ef8408
commit 49e196db1c

View File

@@ -70,7 +70,13 @@ impl fmt::Debug for Void {
impl fmt::Display for Error { impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 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()),
}
} }
} }