From cd976c8fb90b1ae60c68d10cb7555a08c709b777 Mon Sep 17 00:00:00 2001 From: santos227 Date: Wed, 2 Mar 2022 01:39:01 +1100 Subject: [PATCH] core/src/transport: Don't print inner error when returning as source (#2533) According to https://github.com/rust-lang/project-error-handling/issues/44#issuecomment-858151860, 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. --- core/src/transport.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/transport.rs b/core/src/transport.rs index 664d55b1..e13aecce 100644 --- a/core/src/transport.rs +++ b/core/src/transport.rs @@ -393,7 +393,7 @@ where TransportError::MultiaddrNotSupported(addr) => { write!(f, "Multiaddr is not supported: {}", addr) } - TransportError::Other(err) => write!(f, "{}", err), + TransportError::Other(_) => Ok(()), } } }