diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-12-02 08:51:36 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-12-02 08:55:18 +0100 |
| commit | fe37fbe606f099e81c693fae248c23c8f8fd5735 (patch) | |
| tree | 604b80f9507866f60a576a7a14362df42f8aeb6e /src/bitcoin-cli.cpp | |
| parent | Merge #9239: Disable fee estimates for 1 block target (diff) | |
| download | discoin-fe37fbe606f099e81c693fae248c23c8f8fd5735.tar.xz discoin-fe37fbe606f099e81c693fae248c23c8f8fd5735.zip | |
bitcoin-cli: Make error message less confusing
Sorry for the churn on this, but the current message (introduced in #9073)
isn't acceptable:
$ src/bitcoin-cli getinfo
rpc: couldn't connect to server
(make sure server is running and you are connecting to the correct RPC port: -1 unknown)
Putting the error code after the words "RPC port" made me wonder whether
there was a port configuration issue.
This changes it to:
$ src/bitcoin-cli getinfo
error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)
Diffstat (limited to 'src/bitcoin-cli.cpp')
| -rw-r--r-- | src/bitcoin-cli.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index b27264081..596cc8ead 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -247,7 +247,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params) event_base_free(base); 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) 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) |