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

automerge
This commit is contained in:
mergify[bot]
2019-12-02 11:52:57 -08:00
committed by Grimes
parent 6ce9f97254
commit 17db734783
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!(