Error Display implementation contains source display impl as well #213
Labels
A-tonic
C-enhancement
Category: New feature or request
E-help-wanted
Call for participation: Help is requested to fix this issue.
Feature Request
When printing a connection refused error and all its source errors you currently end up with:
That is very redundant and not very nice to read. A good rule is to not include the
Display
implementation of your source error in your error. Or if you do, don't return it fromsource()
. Never do both.I created a forum post on this topic a while back: https://users.rust-lang.org/t/do-people-not-care-about-printable-error-chains-a-k-a-how-to-nicely-implement-display-for-an-error/35362
I see the stack of errors here is not only
tonic
specific, but the problem exists inhyper
as well.Proposal
Change some error type implementations. Especially if there are errors which are basically just combinations of sub-errors, then make them "transparent". Meaning their
Display
impl just proxies to theDisplay
of the sub-error andsource()
become something like:The text was updated successfully, but these errors were encountered: