From 7a33caa1d250eb42830543737f9fc557d5c970be Mon Sep 17 00:00:00 2001 From: glyph Date: Mon, 25 Oct 2021 16:29:18 +0200 Subject: [PATCH] fix probe error code assertion --- peach-probe/src/probe.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/peach-probe/src/probe.rs b/peach-probe/src/probe.rs index cb9d45f..7abe3db 100644 --- a/peach-probe/src/probe.rs +++ b/peach-probe/src/probe.rs @@ -192,6 +192,7 @@ impl PeachProbe { PeachError::Serde { source } => { eprintln!("Returned Serde JSON serialization error: {:#?}\n", source) } + _ => (), } result.failures.push(endpoint_name.to_string()); } @@ -213,11 +214,16 @@ impl PeachProbe { } Err(e) => { match e { - PeachError::JsonRpcCore { err } => { - match err.kind() { + PeachError::JsonRpcCore { ref err } => { + match err { // this is the expected error, all other errors are unexpected - jsonrpc_client_core::ErrorKind::JsonRpcError(err) => { - if err.code.code() == expected_error_code { + //jsonrpc_client_core::ErrorKind::JsonRpcError(err) => { + peach_lib::jsonrpc_core::Error { + code, + message: _, + data: _, + } => { + if code.code() == expected_error_code { if self.verbose { println!("++ {} endpoint is online", endpoint_name); } @@ -228,11 +234,6 @@ impl PeachProbe { result.failures.push(endpoint_name.to_string()); } } - _ => { - eprintln!("++ {} endpoint is offline", endpoint_name); - eprintln!("Returned unexpected JsonRpcCore error: {:#?}\n", e); - result.failures.push(endpoint_name.to_string()); - } } } PeachError::JsonRpcHttp { source } => { @@ -245,6 +246,7 @@ impl PeachProbe { eprintln!("Returned Serde JSON serialization error: {:#?}\n", source); result.failures.push(endpoint_name.to_string()); } + _ => (), } } }