Merge #9073: Trivial: Add common failure cases for rpc server connection failure

8f329f9 Add common failure cases for rpc server connection failure (instagibbs)
This commit is contained in:
Wladimir J. van der Laan 2016-11-03 19:18:22 +01:00 committed by Alexander Block
parent dd7669bc7c
commit 5adb5b8e8a

View File

@ -255,7 +255,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
event_base_free(base); event_base_free(base);
if (response.status == 0) if (response.status == 0)
throw CConnectionFailed(strprintf("couldn't connect to server (%d %s)", response.error, http_errorstring(response.error))); throw CConnectionFailed(strprintf("couldn't connect to server\n(make sure server is running and you are connecting to the correct RPC port: %d %s)", response.error, http_errorstring(response.error)));
else if (response.status == HTTP_UNAUTHORIZED) else if (response.status == HTTP_UNAUTHORIZED)
throw runtime_error("incorrect rpcuser or rpcpassword (authorization failed)"); throw runtime_error("incorrect rpcuser or rpcpassword (authorization failed)");
else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR) else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR)