fix(swarm): display cause of denied listen error

The display of `ListenError` could be more helpful. The inner `cause` already implements `Error` which in turn requires `Display`. This is then just a matter of using said impl requirement to get an useful display

Pull-Request: #4232.
This commit is contained in:
Divma
2023-07-24 14:52:51 -05:00
committed by GitHub
parent 7f2ef013a8
commit da743ec486
5 changed files with 11 additions and 5 deletions

View File

@ -1684,8 +1684,8 @@ impl fmt::Display for ListenError {
ListenError::Transport(_) => {
write!(f, "Listen error: Failed to negotiate transport protocol(s)")
}
ListenError::Denied { .. } => {
write!(f, "Listen error")
ListenError::Denied { cause } => {
write!(f, "Listen error: Denied: {cause}")
}
ListenError::LocalPeerId { endpoint } => {
write!(f, "Listen error: Local peer ID at {endpoint:?}.")