Merge pull request #31 from nox/unexpected-eof

Introduce HandshakeError::code
This commit is contained in:
Ivan Nikulin 2021-04-16 11:57:48 +01:00 committed by GitHub
commit 61e69eb3e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.
pub fn as_io_error(&self) -> Option<&io::Error> {
match &self.0 {