-
Notifications
You must be signed in to change notification settings - Fork 957
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
Add error messages for interrupt #704
Add error messages for interrupt #704
Conversation
The error should be an enum if anything, not a |
Fixed, all tests pass with |
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.
LGTM. It would be good to add a test for the new errors too. See interrupting_an_established_connection_is_err
where we simply check if the outcome is_err()
.
core/src/nodes/collection.rs
Outdated
pub enum InterruptErr { | ||
/// The task entry is vacant; it needs to be added first via add_reach_attempt | ||
/// (with the TaskState set to Pending) before we try to connect. | ||
VacantEntry, |
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.
While it is technically correct that the problem is the entry in the hashmap being vacant, the real error is that they're trying to interrupt using an invalid reach attempt. I think this error variant should reflect that. How about NoSuchReachAttemptId
? or just ReachAttemptNotFound
?
…hub.com/jamesray1/rust-libp2p into fix/collection-interrupt-error-messages
Co-Authored-By: jamesray1 <16969914+jamesray1@users.noreply.github.com>
…hub.com/jamesray1/rust-libp2p into fix/collection-interrupt-error-messages
…hub.com/jamesray1/rust-libp2p into fix/collection-interrupt-error-messages
@tomaka can you give this a once-over at your convenience? |
* upstream/master: Rename all the network behaviours to more basic names (libp2p#726) Avoid some warnings. (libp2p#733) Add error messages for interrupt (libp2p#704) Remove relay, peerstore and datastore (libp2p#723) Don't add an address to the topology if it is already in (libp2p#724) Add a few more methods to Swarm and PollParameters (libp2p#721) Some changes to the main libp2p doc (libp2p#710) Don't wrap yamux::Connection in a mutex (libp2p#719) relay: Use `SliceRandom::shuffle`. (libp2p#722) Remove some boxed futures. (libp2p#718) Fix several errors reported by clippy. (libp2p#715)
No description provided.