diff --git a/src/http.rs b/src/http.rs index 0461690c..1442dabb 100644 --- a/src/http.rs +++ b/src/http.rs @@ -75,8 +75,9 @@ pub async fn do_http_request( )), }; match make_http_request(request, cost).await { - Ok((result,)) => String::from_utf8(result.body) - .map_err(|_| EthRpcError::InvalidResponse("expected UTF-8".to_string())), + Ok((result,)) => { + String::from_utf8(result.body).map_err(|_| EthRpcError::ResponseParseError) + } Err((r, m)) => { inc_metric!(request_err_http); Err(EthRpcError::HttpRequestError { diff --git a/src/types.rs b/src/types.rs index 0eadd1c6..5e2d7710 100644 --- a/src/types.rs +++ b/src/types.rs @@ -232,7 +232,7 @@ pub enum EthRpcError { TooFewCycles { expected: u128, received: u128 }, ServiceUrlParseError, ServiceHostNotAllowed(String), - InvalidResponse(String), + ResponseParseError, ProviderNotFound, HttpRequestError { code: u32, message: String }, }