committed by
Michael Vines
parent
0ec301f1c3
commit
88177d33fd
@ -125,10 +125,8 @@ impl RpcSender for HttpSender {
|
|||||||
.body(request_json)
|
.body(request_json)
|
||||||
.send()
|
.send()
|
||||||
})
|
})
|
||||||
};
|
}?;
|
||||||
|
|
||||||
match response {
|
|
||||||
Ok(response) => {
|
|
||||||
if !response.status().is_success() {
|
if !response.status().is_success() {
|
||||||
if response.status() == StatusCode::TOO_MANY_REQUESTS
|
if response.status() == StatusCode::TOO_MANY_REQUESTS
|
||||||
&& too_many_requests_retries > 0
|
&& too_many_requests_retries > 0
|
||||||
@ -157,12 +155,10 @@ impl RpcSender for HttpSender {
|
|||||||
return Err(response.error_for_status().unwrap_err().into());
|
return Err(response.error_for_status().unwrap_err().into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let response_text = tokio::task::block_in_place(move || response.text())?;
|
let mut json =
|
||||||
|
tokio::task::block_in_place(move || response.json::<serde_json::Value>())?;
|
||||||
let json: serde_json::Value = serde_json::from_str(&response_text)?;
|
|
||||||
if json["error"].is_object() {
|
if json["error"].is_object() {
|
||||||
return match serde_json::from_value::<RpcErrorObject>(json["error"].clone())
|
return match serde_json::from_value::<RpcErrorObject>(json["error"].clone()) {
|
||||||
{
|
|
||||||
Ok(rpc_error_object) => {
|
Ok(rpc_error_object) => {
|
||||||
let data = match rpc_error_object.code {
|
let data = match rpc_error_object.code {
|
||||||
rpc_custom_error::JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE => {
|
rpc_custom_error::JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE => {
|
||||||
@ -200,12 +196,7 @@ impl RpcSender for HttpSender {
|
|||||||
.into()),
|
.into()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return Ok(json["result"].clone());
|
return Ok(json["result"].take());
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
return Err(err.into());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user