Skip to content

Commit 5620fbf

Browse files
DarinM223seanmonstar
authored andcommitted
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 cb119a1 commit 5620fbf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/error.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ impl fmt::Debug for Void {
6868

6969
impl fmt::Display for Error {
7070
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
71-
f.write_str(self.description())
71+
match *self {
72+
Uri(ref e) => fmt::Display::fmt(e, f),
73+
Io(ref e) => fmt::Display::fmt(e, f),
74+
Ssl(ref e) => fmt::Display::fmt(e, f),
75+
Utf8(ref e) => fmt::Display::fmt(e, f),
76+
ref e => f.write_str(e.description()),
77+
}
7278
}
7379
}
7480

0 commit comments

Comments
 (0)