chore: use Display instead of Debug for most errors (#6777)

This commit is contained in:
DaniPopes
2024-02-24 14:13:41 +02:00
committed by GitHub
parent da3f469758
commit 94cb6a8bcd
36 changed files with 106 additions and 105 deletions

View File

@ -11,7 +11,6 @@ use std::io;
/// Errors when sending/receiving messages
#[derive(thiserror::Error, Debug)]
pub enum EthStreamError {
#[error(transparent)]
/// Error of the underlying P2P connection.

View File

@ -134,7 +134,7 @@ where
Err(P2PStreamError::HandshakeError(P2PHandshakeError::Disconnected(reason)))
}
Err(err) => {
debug!(?err, msg=%hex::encode(&first_message_bytes), "Failed to decode first message from peer");
debug!(%err, msg=%hex::encode(&first_message_bytes), "Failed to decode first message from peer");
Err(P2PStreamError::HandshakeError(err.into()))
}
Ok(msg) => {
@ -349,7 +349,7 @@ impl<S> DisconnectP2P for P2PStream<S> {
let compressed_size =
self.encoder.compress(&buf[1..], &mut compressed[1..]).map_err(|err| {
debug!(
?err,
%err,
msg=%hex::encode(&buf[1..]),
"error compressing disconnect"
);
@ -436,7 +436,7 @@ where
// to decompress the message before we can decode it.
this.decoder.decompress(&bytes[1..], &mut decompress_buf[1..]).map_err(|err| {
debug!(
?err,
%err,
msg=%hex::encode(&bytes[1..]),
"error decompressing p2p message"
);
@ -455,7 +455,7 @@ where
_ if id == P2PMessageID::Disconnect as u8 => {
let reason = DisconnectReason::decode(&mut &decompress_buf[1..]).map_err(|err| {
debug!(
?err, msg=%hex::encode(&decompress_buf[1..]), "Failed to decode disconnect message from peer"
%err, msg=%hex::encode(&decompress_buf[1..]), "Failed to decode disconnect message from peer"
);
err
})?;
@ -573,7 +573,7 @@ where
let compressed_size =
this.encoder.compress(&item[1..], &mut compressed[1..]).map_err(|err| {
debug!(
?err,
%err,
msg=%hex::encode(&item[1..]),
"error compressing p2p message"
);