Skip to content

Commit

Permalink
Don't print inner error when returning as source
Browse files Browse the repository at this point in the history
According to rust-lang/project-error-handling#44 (comment), we should not be printing the inner error AND returning it as source. Libraries like `anyhow` will traverse the chain of `source` errors and build up a composed error message. Printing it and returning the same error from `source` results in duplicate error messages in that case.
  • Loading branch information
thomaseizinger committed Feb 24, 2022
1 parent b185946 commit ccfd498
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ where
TransportError::MultiaddrNotSupported(addr) => {
write!(f, "Multiaddr is not supported: {}", addr)
}
TransportError::Other(err) => write!(f, "{}", err),
TransportError::Other(_) => Ok(()),
}
}
}
Expand Down

0 comments on commit ccfd498

Please sign in to comment.