Use Display for ssl::Error in Display for ssl::HandshakeError
This commit is contained in:
parent
56564c7cb6
commit
4353e4f8f3
|
|
@ -60,7 +60,7 @@ impl ErrorStack {
|
||||||
impl fmt::Display for ErrorStack {
|
impl fmt::Display for ErrorStack {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
if self.0.is_empty() {
|
if self.0.is_empty() {
|
||||||
return fmt.write_str("unknown OpenSSL error");
|
return fmt.write_str("unknown BoringSSL error");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ impl fmt::Display for Error {
|
||||||
},
|
},
|
||||||
ErrorCode::SSL => match self.ssl_error() {
|
ErrorCode::SSL => match self.ssl_error() {
|
||||||
Some(e) => write!(fmt, "{}", e),
|
Some(e) => write!(fmt, "{}", e),
|
||||||
None => fmt.write_str("OpenSSL error"),
|
None => fmt.write_str("unknown BoringSSL error"),
|
||||||
},
|
},
|
||||||
ErrorCode(code) => write!(fmt, "unknown error code {}", code),
|
ErrorCode(code) => write!(fmt, "unknown error code {}", code),
|
||||||
}
|
}
|
||||||
|
|
@ -174,15 +174,7 @@ fn fmt_mid_handshake_error(
|
||||||
verify => write!(f, "{}: cert verification failed - {}", prefix, verify)?,
|
verify => write!(f, "{}: cert verification failed - {}", prefix, verify)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(error) = s.error().io_error() {
|
write!(f, " {}", s.error())
|
||||||
return write!(f, " ({})", error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(error) = s.error().ssl_error() {
|
|
||||||
write!(f, " {}", error)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> From<ErrorStack> for HandshakeError<S> {
|
impl<S> From<ErrorStack> for HandshakeError<S> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue