Introduce HandshakeError::code

This commit is contained in:
Anthony Ramine 2021-04-16 12:31:28 +02:00
parent 90a195c9fe
commit 4473d08df4
1 changed files with 8 additions and 0 deletions

View File

@ -293,6 +293,14 @@ impl<S> HandshakeError<S> {
} }
} }
/// Returns the error code, if any.
pub fn code(&self) -> Option<ErrorCode> {
match &self.0 {
ssl::HandshakeError::Failure(s) => Some(s.error().code()),
_ => None,
}
}
/// Returns a reference to the inner I/O error, if any. /// Returns a reference to the inner I/O error, if any.
pub fn as_io_error(&self) -> Option<&io::Error> { pub fn as_io_error(&self) -> Option<&io::Error> {
match &self.0 { match &self.0 {