Skip to content

Commit 69d6fd6

Browse files
committed
cli: improve bitcoin-cli error when not connected
Adds a string suggestion `bitcoin-cli -help` as an additional source of information.
1 parent bf1b638 commit 69d6fd6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bitcoin-cli.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,10 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
827827
if (response.error != -1) {
828828
responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error));
829829
}
830-
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));
830+
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\n"
831+
"Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n"
832+
"Use \"bitcoin-cli -help\" for more info.",
833+
host, port, responseErrorMessage));
831834
} else if (response.status == HTTP_UNAUTHORIZED) {
832835
if (failedToGetAuthCookie) {
833836
throw std::runtime_error(strprintf(

0 commit comments

Comments
 (0)