From dd04ec0ef462670cc3b3cba02957a85e01f32e9c Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 6 Apr 2021 10:04:46 +0200 Subject: [PATCH] Provide access to inner I/O error during handshake --- tokio-boring/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tokio-boring/src/lib.rs b/tokio-boring/src/lib.rs index 1ed5c25a..35b9dac9 100644 --- a/tokio-boring/src/lib.rs +++ b/tokio-boring/src/lib.rs @@ -292,6 +292,14 @@ impl HandshakeError { _ => None, } } + + /// Returns a reference to the inner I/O error, if any. + pub fn as_io_error(&self) -> Option<&io::Error> { + match &self.0 { + ssl::HandshakeError::Failure(s) => s.error().io_error(), + _ => None, + } + } } impl fmt::Debug for HandshakeError