Skip to content

Commit aa66a7f

Browse files
Don't print inner error when returning as source
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.
1 parent b185946 commit aa66a7f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/transport.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub mod upgrade;
4242
mod boxed;
4343
mod optional;
4444

45+
pub use self::boxed::boxed;
4546
pub use self::boxed::Boxed;
4647
pub use self::choice::OrTransport;
4748
pub use self::memory::MemoryTransport;
@@ -393,7 +394,7 @@ where
393394
TransportError::MultiaddrNotSupported(addr) => {
394395
write!(f, "Multiaddr is not supported: {}", addr)
395396
}
396-
TransportError::Other(err) => write!(f, "{}", err),
397+
TransportError::Other(_) => Ok(()),
397398
}
398399
}
399400
}

0 commit comments

Comments
 (0)