Skip to content

Commit 49e196d

Browse files
committed
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
1 parent 1088ef8 commit 49e196d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/error.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ impl fmt::Debug for Void {
7070

7171
impl fmt::Display for Error {
7272
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
73-
f.write_str(self.description())
73+
match *self {
74+
Uri(ref e) => fmt::Display::fmt(e, f),
75+
Io(ref e) => fmt::Display::fmt(e, f),
76+
Ssl(ref e) => fmt::Display::fmt(e, f),
77+
Utf8(ref e) => fmt::Display::fmt(e, f),
78+
ref e => f.write_str(e.description()),
79+
}
7480
}
7581
}
7682

0 commit comments

Comments
 (0)