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 aa66a7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub mod upgrade;
mod boxed;
mod optional;

pub use self::boxed::boxed;
pub use self::boxed::Boxed;
pub use self::choice::OrTransport;
pub use self::memory::MemoryTransport;
Expand Down Expand Up @@ -393,7 +394,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 aa66a7f

Please sign in to comment.