Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(swarm): better error message for failed DialPeerConditions #4409

Merged
merged 10 commits into from
Sep 6, 2023
6 changes: 4 additions & 2 deletions swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,8 +1580,10 @@ impl fmt::Display for DialError {
f,
"Dial error: tried to dial local peer id at {endpoint:?}."
),
DialError::DialPeerConditionFalse(c) => {
write!(f, "Dial error: condition {c:?} for dialing peer was false.")
DialError::DialPeerConditionFalse(condition) => match condition {
chirag-bgh marked this conversation as resolved.
Show resolved Hide resolved
PeerCondition::Disconnected => write!(f, "Dial error: condition dial was configured to only happen when disconnected (`PeerCondition::Disconnected`), but node is already connected, thus cancelling new dial."),
PeerCondition::NotDialing => write!(f, "Dial error: condition dial was configured to only if there is currently no ongoing dialing attempt (`PeerCondition::NotDialing`), but node is already dialing, thus cancelling new dial."),
chirag-bgh marked this conversation as resolved.
Show resolved Hide resolved
PeerCondition::Always => write!(f, "Dial error: condition dial was configured to always happen (`PeerCondition::Always`)."),
chirag-bgh marked this conversation as resolved.
Show resolved Hide resolved
}
DialError::Aborted => write!(
f,
Expand Down