Merge pull request #926 from sfackler/clean-errors
Improve error Display impls
This commit is contained in:
commit
41b0520416
|
|
@ -99,17 +99,18 @@ impl fmt::Display for Error {
|
||||||
Some(_) => fmt.write_str("a nonblocking read call would have blocked"),
|
Some(_) => fmt.write_str("a nonblocking read call would have blocked"),
|
||||||
None => fmt.write_str("the operation should be retried"),
|
None => fmt.write_str("the operation should be retried"),
|
||||||
},
|
},
|
||||||
|
ErrorCode::WANT_WRITE => match self.io_error() {
|
||||||
|
Some(_) => fmt.write_str("a nonblocking write call would have blocked"),
|
||||||
|
None => fmt.write_str("the operation should be retried"),
|
||||||
|
},
|
||||||
ErrorCode::SYSCALL => match self.io_error() {
|
ErrorCode::SYSCALL => match self.io_error() {
|
||||||
Some(err) => write!(fmt, "the inner stream returned an error: {}", err),
|
Some(err) => write!(fmt, "{}", err),
|
||||||
None => fmt.write_str("unexpected EOF"),
|
None => fmt.write_str("unexpected EOF"),
|
||||||
},
|
},
|
||||||
ErrorCode::SSL => {
|
ErrorCode::SSL => match self.ssl_error() {
|
||||||
fmt.write_str("OpenSSL error")?;
|
Some(e) => write!(fmt, "{}", e),
|
||||||
if let Some(ref err) = self.ssl_error() {
|
None => fmt.write_str("OpenSSL error"),
|
||||||
write!(fmt, ": {}", err)?
|
},
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
ErrorCode(code) => write!(fmt, "unknown error code {}", code),
|
ErrorCode(code) => write!(fmt, "unknown error code {}", code),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue