Improve error handling when the user mixes up gossip (8001) and RPC (8899) ports (#7158)

automerge
This commit is contained in:
Michael Vines
2019-12-02 10:01:25 -07:00
committed by Grimes
parent 0f872af502
commit 1eaf71b5b4
3 changed files with 154 additions and 63 deletions

View File

@ -56,6 +56,10 @@ impl GenericRpcClientRequest for RpcClientRequest {
.send()
{
Ok(mut response) => {
if !response.status().is_success() {
return Err(response.error_for_status().unwrap_err().into());
}
let json: serde_json::Value = serde_json::from_str(&response.text()?)?;
if json["error"].is_object() {
return Err(RpcError::RpcRequestError(format!(