Skip to content
Snippets Groups Projects
Commit d94aa533 authored by Toralf Wittner's avatar Toralf Wittner Committed by GitHub
Browse files

Log kademlia errors when get/put record fails. (#4988)


* Log kademlia errors when get/put record fails.

The current approach makes it difficult to figure out what the
underlying error was, that made the operation fail.

* Formatting

Co-Authored-By: default avatarPierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: default avatarPierre Krieger <pierre.krieger1708@gmail.com>
parent a832d138
No related merge requests found
......@@ -391,7 +391,14 @@ impl NetworkBehaviour for DiscoveryBehaviour {
DiscoveryOut::ValueFound(results)
}
Err(e @ libp2p::kad::GetRecordError::NotFound { .. }) => {
trace!(target: "sub-libp2p",
"Libp2p => Failed to get record: {:?}", e);
DiscoveryOut::ValueNotFound(e.into_key())
}
Err(e) => {
warn!(target: "sub-libp2p",
"Libp2p => Failed to get record: {:?}", e);
DiscoveryOut::ValueNotFound(e.into_key())
}
};
......@@ -401,6 +408,8 @@ impl NetworkBehaviour for DiscoveryBehaviour {
let ev = match res {
Ok(ok) => DiscoveryOut::ValuePut(ok.key),
Err(e) => {
warn!(target: "sub-libp2p",
"Libp2p => Failed to put record: {:?}", e);
DiscoveryOut::ValuePutFailed(e.into_key())
}
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment