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.
This commit is contained in:
Thomas Eizinger 2022-03-02 01:39:01 +11:00 committed by GitHub
parent fd31d61a7f
commit d1f472b3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -393,7 +393,7 @@ where
TransportError::MultiaddrNotSupported(addr) => { TransportError::MultiaddrNotSupported(addr) => {
write!(f, "Multiaddr is not supported: {}", addr) write!(f, "Multiaddr is not supported: {}", addr)
} }
TransportError::Other(err) => write!(f, "{}", err), TransportError::Other(_) => Ok(()),
} }
} }
} }