-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(autonat::v2::client): DialBackError
visibility
#6168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Left a comment below
pub struct Error { | ||
pub(crate) inner: dial_request::DialBackError, | ||
} | ||
|
||
impl Display for Error { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
Display::fmt(&self.inner, f) | ||
} | ||
} | ||
|
||
impl Debug for Error { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
Debug::fmt(&self.inner, f) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldnt it be better to leave this in place but implement Error
(or maybe use thiserror::Error
and use #[error(transparent)]
) so you can downcast to DialBackError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly gave that a small thought initially. I definitely like the second approach more. But I fail to identify a benefit from that layer of indirection, so came with this approach; do you have some on your mind? Like IIRC the idea of thiserror
is that someone downstream who uses it can wrap this easily for their needs, and we don't imply it on those who don't want to use it. 😆
Co-authored-by: Darius Clark <[email protected]>
Description
Fix visibility so downstream could differentiate between
NoConnection
andStreamFailed
.Notes & open questions
I guess this one doesn't need adding a test, but if you suggest a good one that would be interesting. Though I can imagine you'd like to add this somewhere in the integration tests on the whole
libp2p
level in a separate issue.Change checklist