Merge #9265: bitcoin-cli: Make error message less confusing

fe37fbe bitcoin-cli: Make error message less confusing (Wladimir J. van der Laan)
This commit is contained in:
MarcoFalke 2016-12-02 15:54:53 +01:00
commit 31bcc66786
No known key found for this signature in database
GPG key ID: 2D7F2372E50FE137

View file

@ -247,7 +247,7 @@ UniValue CallRPC(const std::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\n(make sure server is running and you are connecting to the correct RPC port: %d %s)", response.error, http_errorstring(response.error))); throw CConnectionFailed(strprintf("couldn't connect to server: %s (code %d)\n(make sure server is running and you are connecting to the correct RPC port)", http_errorstring(response.error), response.error));
else if (response.status == HTTP_UNAUTHORIZED) else if (response.status == HTTP_UNAUTHORIZED)
throw std::runtime_error("incorrect rpcuser or rpcpassword (authorization failed)"); throw std::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)