Skip to content

Commit

Permalink
cli: improve bitcoin-cli error when not connected
Browse files Browse the repository at this point in the history
Adds a string suggestion `bitcoin-cli -help` as an additional source of
information.
  • Loading branch information
willcl-ark committed Mar 21, 2024
1 parent bf1b638 commit 69d6fd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,10 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
if (response.error != -1) {
responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error));
}
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the bitcoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\n"
"Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n"
"Use \"bitcoin-cli -help\" for more info.",
host, port, responseErrorMessage));
} else if (response.status == HTTP_UNAUTHORIZED) {
if (failedToGetAuthCookie) {
throw std::runtime_error(strprintf(
Expand Down

0 comments on commit 69d6fd6

Please sign in to comment.