impl std::error::Error for Error close #6

This commit is contained in:
Martin Algesten
2019-06-21 15:14:58 +02:00
parent 41b21d37e4
commit 32279c84e0

View File

@@ -1,4 +1,5 @@
use std::io::Error as IoError;
use std::fmt;
/// Errors that are translated to ["synthetic" responses](struct.Response.html#method.synthetic).
#[derive(Debug)]
@@ -70,3 +71,11 @@ impl From<IoError> for Error {
Error::Io(err)
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.body_text())
}
}
impl std::error::Error for Error {}