From 56564c7cb6d0ebfa8a32a8d0bddf80e5ae4d581e Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 15 Mar 2021 10:56:53 +0100 Subject: [PATCH] Tweak yet again the boring error reporting We also omit file and line in ErrorStack itself now too. ErrorStack is the wrapped error type returned by hyper_boring::HttpsConnector::call. --- boring/src/error.rs | 6 +++--- boring/src/ssl/error.rs | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/boring/src/error.rs b/boring/src/error.rs index 0c35e29e..0bd71e14 100644 --- a/boring/src/error.rs +++ b/boring/src/error.rs @@ -60,16 +60,16 @@ impl ErrorStack { impl fmt::Display for ErrorStack { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { if self.0.is_empty() { - return fmt.write_str("OpenSSL error"); + return fmt.write_str("unknown OpenSSL error"); } let mut first = true; for err in &self.0 { if !first { - fmt.write_str("\n--\n")?; + fmt.write_str(" ")?; } - write!(fmt, "{}", err)?; first = false; + write!(fmt, "[{}]", err.reason().unwrap_or("unknown reason"))?; } Ok(()) } diff --git a/boring/src/ssl/error.rs b/boring/src/ssl/error.rs index a61a743f..bd771de6 100644 --- a/boring/src/ssl/error.rs +++ b/boring/src/ssl/error.rs @@ -154,7 +154,7 @@ impl fmt::Display for HandshakeError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { HandshakeError::SetupFailure(ref e) => { - write!(f, "TLS stream setup failed:\n\n{}", e) + write!(f, "TLS stream setup failed {}", e) } HandshakeError::Failure(ref s) => fmt_mid_handshake_error(s, f, "TLS handshake failed"), HandshakeError::WouldBlock(ref s) => { @@ -179,9 +179,7 @@ fn fmt_mid_handshake_error( } if let Some(error) = s.error().ssl_error() { - for error in error.errors() { - write!(f, " [{}]", error.reason().unwrap_or("unknown error"),)?; - } + write!(f, " {}", error)?; } Ok(())