Skip to content

Commit

Permalink
Replace 'InvalidResponse' -> 'ResponseParseError' for specificity
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanasa committed Oct 4, 2023
1 parent 727bbc8 commit 5a65929
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub enum EthRpcError {
TooFewCycles { expected: u128, received: u128 },
ServiceUrlParseError,
ServiceHostNotAllowed(String),
InvalidResponse(String),
ResponseParseError,
ProviderNotFound,
HttpRequestError { code: u32, message: String },
}
Expand Down

0 comments on commit 5a65929

Please sign in to comment.