Skip to content

Commit

Permalink
Print error chain for ConnectionHandlerUpgrErr
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Ermolaev committed Mar 13, 2023
1 parent 1d4e03c commit 8b4c290
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions swarm/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl<TUpgrErr> ConnectionHandlerUpgrErr<TUpgrErr> {

impl<TUpgrErr> fmt::Display for ConnectionHandlerUpgrErr<TUpgrErr>
where
TUpgrErr: fmt::Display,
TUpgrErr: error::Error + 'static,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Expand All @@ -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)
}
}
}
}
Expand All @@ -481,7 +484,7 @@ where
match self {
ConnectionHandlerUpgrErr::Timeout => None,
ConnectionHandlerUpgrErr::Timer => None,
ConnectionHandlerUpgrErr::Upgrade(err) => Some(err),
ConnectionHandlerUpgrErr::Upgrade(_) => None,
}
}
}
Expand Down

0 comments on commit 8b4c290

Please sign in to comment.