Skip to content

Commit

Permalink
Implements Error for GetRecordError (#2612)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janmajayamall committed Apr 11, 2022
1 parent a1f3547 commit 7b1d4cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2555,17 +2555,20 @@ pub struct GetRecordOk {
}

/// The error result of [`Kademlia::get_record`].
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Error)]
pub enum GetRecordError {
#[error("the record was not found")]
NotFound {
key: record::Key,
closest_peers: Vec<PeerId>,
},
#[error("the quorum failed; needed {quorum} peers")]
QuorumFailed {
key: record::Key,
records: Vec<PeerRecord>,
quorum: NonZeroUsize,
},
#[error("the request timed out")]
Timeout {
key: record::Key,
records: Vec<PeerRecord>,
Expand Down

0 comments on commit 7b1d4cd

Please sign in to comment.