diff --git a/tokio-boring/src/lib.rs b/tokio-boring/src/lib.rs index 35b9dac9..ec330844 100644 --- a/tokio-boring/src/lib.rs +++ b/tokio-boring/src/lib.rs @@ -293,6 +293,14 @@ impl HandshakeError { } } + /// Returns the error code, if any. + pub fn code(&self) -> Option { + 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 {