chore: use Display instead of Debug when printing internal errors (#6242)

This commit is contained in:
DaniPopes
2024-01-26 15:56:27 +01:00
committed by GitHub
parent 7db5edf46b
commit 556741abb0
7 changed files with 10 additions and 10 deletions

View File

@@ -73,7 +73,7 @@ impl Command {
let blocks_and_execution = provider
.take_block_and_execution_range(&self.chain, range)
.map_err(|err| eyre::eyre!("Transaction error on unwind: {err:?}"))?;
.map_err(|err| eyre::eyre!("Transaction error on unwind: {err}"))?;
provider.commit()?;

View File

@@ -643,18 +643,18 @@ impl<DB: Database, EF: ExecutorFactory> BlockchainTree<DB, EF> {
{
error!(
?block,
"Failed to validate total difficulty for block {}: {e:?}", block.header.hash
"Failed to validate total difficulty for block {}: {e}", block.header.hash
);
return Err(e)
}
if let Err(e) = self.externals.consensus.validate_header(block) {
error!(?block, "Failed to validate header {}: {e:?}", block.header.hash);
error!(?block, "Failed to validate header {}: {e}", block.header.hash);
return Err(e)
}
if let Err(e) = self.externals.consensus.validate_block(block) {
error!(?block, "Failed to validate block {}: {e:?}", block.header.hash);
error!(?block, "Failed to validate block {}: {e}", block.header.hash);
return Err(e)
}

View File

@@ -28,7 +28,7 @@ async fn test_http_addr_in_use() {
.start_server(RpcServerConfig::http(Default::default()).with_http_address(addr))
.await;
let err = result.unwrap_err();
assert!(is_addr_in_use_kind(&err, ServerKind::Http(addr)), "{err:?}");
assert!(is_addr_in_use_kind(&err, ServerKind::Http(addr)), "{err}");
}
#[tokio::test(flavor = "multi_thread")]
@@ -40,7 +40,7 @@ async fn test_ws_addr_in_use() {
let result =
server.start_server(RpcServerConfig::ws(Default::default()).with_ws_address(addr)).await;
let err = result.unwrap_err();
assert!(is_addr_in_use_kind(&err, ServerKind::WS(addr)), "{err:?}");
assert!(is_addr_in_use_kind(&err, ServerKind::WS(addr)), "{err}");
}
#[tokio::test(flavor = "multi_thread")]

View File

@@ -20,7 +20,7 @@ async fn trace_many_blocks() {
let mut stream = client.trace_block_buffered_unordered(15_000_000..=16_000_100, 20);
let now = Instant::now();
while let Some((err, block)) = stream.next_err().await {
eprintln!("Error tracing block {block:?}: {err:?}");
eprintln!("Error tracing block {block:?}: {err}");
}
println!("Traced all blocks in {:?}", now.elapsed());
}

View File

@@ -234,7 +234,7 @@ mod tests {
let jwt = "this jwt has serious encoding problems".to_string();
let (status, body) = send_request(Some(jwt)).await;
assert_eq!(status, StatusCode::UNAUTHORIZED);
assert_eq!(body, "JWT decoding error: Error(InvalidToken)".to_string());
assert_eq!(body, "JWT decoding error: InvalidToken".to_string());
}
async fn send_request(jwt: Option<String>) -> (StatusCode, String) {

View File

@@ -142,7 +142,7 @@ impl JwtSecret {
ErrorKind::InvalidSignature => Err(JwtError::InvalidSignature)?,
ErrorKind::InvalidAlgorithm => Err(JwtError::UnsupportedSignatureAlgorithm)?,
_ => {
let detail = format!("{err:?}");
let detail = format!("{err}");
Err(JwtError::JwtDecodingError(detail))?
}
},

View File

@@ -92,7 +92,7 @@ macro_rules! impl_to_rpc_result {
match self {
Ok(t) => Ok(t),
Err(err) => {
let msg = format!("{msg}: {err:?}");
let msg = format!("{msg}: {err}");
Err($crate::result::internal_rpc_err(msg))
}
}