error: wrap io::Error in Arc for clone #2181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ProtoErrorKind
isClone
, but theIo
variant holdingio::Error
runs into trouble with this: since theio::Error
error can't be cloned we have to reconstruct it and this is a lossy proces resulting in a "simple"io::Error
that only holds the error type from the parent it was cloned from. This loses important details like the underlying error source/message.This branch changes
ProtoErrorKind::Io
to holdArc<io::Error>
instead (Note: this is a breaking change). This makes implementingClone
trivial - we clone the arc - and no error information is lost.With this fix in place we get a much better error fidelity from failures like trying to perform DNS-over-HTTPS using Rustls but without a source of trust anchors (e.g. #2066). Previously the error was surfaced as:
With this change in place, the error is now surfaced with much more detail:
Updates #2066