From 4c9fde3623265fa0fd04c4e7126eb7c0805d8939 Mon Sep 17 00:00:00 2001 From: Victor Ermolaev Date: Fri, 10 Mar 2023 13:47:39 +0100 Subject: [PATCH] Print error chain for `ConnectionHandlerUpgrErr` --- swarm/src/handler.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/swarm/src/handler.rs b/swarm/src/handler.rs index 6c0ccc068b7..4093ecaee32 100644 --- a/swarm/src/handler.rs +++ b/swarm/src/handler.rs @@ -458,7 +458,7 @@ impl ConnectionHandlerUpgrErr { impl fmt::Display for ConnectionHandlerUpgrErr where - TUpgrErr: fmt::Display, + TUpgrErr: error::Error + 'static, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -468,7 +468,10 @@ where ConnectionHandlerUpgrErr::Timer => { write!(f, "Timer error while opening a substream") } - ConnectionHandlerUpgrErr::Upgrade(err) => write!(f, "{err}"), + ConnectionHandlerUpgrErr::Upgrade(err) => { + write!(f, "Upgrade: ")?; + crate::print_error_chain(f, err) + } } } } @@ -481,7 +484,7 @@ where match self { ConnectionHandlerUpgrErr::Timeout => None, ConnectionHandlerUpgrErr::Timer => None, - ConnectionHandlerUpgrErr::Upgrade(err) => Some(err), + ConnectionHandlerUpgrErr::Upgrade(_) => None, } } }