fix probe error code assertion

This commit is contained in:
glyph 2021-10-25 16:29:18 +02:00
parent 277fe3dc43
commit 7a33caa1d2
1 changed files with 11 additions and 9 deletions

View File

@ -192,6 +192,7 @@ impl PeachProbe {
PeachError::Serde { source } => { PeachError::Serde { source } => {
eprintln!("Returned Serde JSON serialization error: {:#?}\n", source) eprintln!("Returned Serde JSON serialization error: {:#?}\n", source)
} }
_ => (),
} }
result.failures.push(endpoint_name.to_string()); result.failures.push(endpoint_name.to_string());
} }
@ -213,11 +214,16 @@ impl PeachProbe {
} }
Err(e) => { Err(e) => {
match e { match e {
PeachError::JsonRpcCore { err } => { PeachError::JsonRpcCore { ref err } => {
match err.kind() { match err {
// this is the expected error, all other errors are unexpected // this is the expected error, all other errors are unexpected
jsonrpc_client_core::ErrorKind::JsonRpcError(err) => { //jsonrpc_client_core::ErrorKind::JsonRpcError(err) => {
if err.code.code() == expected_error_code { peach_lib::jsonrpc_core::Error {
code,
message: _,
data: _,
} => {
if code.code() == expected_error_code {
if self.verbose { if self.verbose {
println!("++ {} endpoint is online", endpoint_name); println!("++ {} endpoint is online", endpoint_name);
} }
@ -228,11 +234,6 @@ impl PeachProbe {
result.failures.push(endpoint_name.to_string()); 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 } => { PeachError::JsonRpcHttp { source } => {
@ -245,6 +246,7 @@ impl PeachProbe {
eprintln!("Returned Serde JSON serialization error: {:#?}\n", source); eprintln!("Returned Serde JSON serialization error: {:#?}\n", source);
result.failures.push(endpoint_name.to_string()); result.failures.push(endpoint_name.to_string());
} }
_ => (),
} }
} }
} }