aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2018-05-20 20:28:48 -0700
committerGitHub <[email protected]>2018-05-20 20:28:48 -0700
commit41b0520416193ad0b65a3cc0ca89d3ca702f6a08 (patch)
treeec61126d09912bafb8b807325c9504b84f8d6dd7
parentMerge pull request #925 from sfackler/stack-sync-send (diff)
parentImprove error Display impls (diff)
downloadrust-openssl-41b0520416193ad0b65a3cc0ca89d3ca702f6a08.tar.xz
rust-openssl-41b0520416193ad0b65a3cc0ca89d3ca702f6a08.zip
Merge pull request #926 from sfackler/clean-errors
Improve error Display impls
-rw-r--r--openssl/src/ssl/error.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/openssl/src/ssl/error.rs b/openssl/src/ssl/error.rs
index 18e44cd6..b7e29c15 100644
--- a/openssl/src/ssl/error.rs
+++ b/openssl/src/ssl/error.rs
@@ -99,17 +99,18 @@ impl fmt::Display for Error {
Some(_) => fmt.write_str("a nonblocking read call would have blocked"),
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() {
- Some(err) => write!(fmt, "the inner stream returned an error: {}", err),
+ Some(err) => write!(fmt, "{}", err),
None => fmt.write_str("unexpected EOF"),
},
- ErrorCode::SSL => {
- fmt.write_str("OpenSSL error")?;
- if let Some(ref err) = self.ssl_error() {
- write!(fmt, ": {}", err)?
- }
- Ok(())
- }
+ ErrorCode::SSL => match self.ssl_error() {
+ Some(e) => write!(fmt, "{}", e),
+ None => fmt.write_str("OpenSSL error"),
+ },
ErrorCode(code) => write!(fmt, "unknown error code {}", code),
}
}