aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorwillcl-ark <will@256k1.dev>2024-03-21 10:29:43 +0000
committerwillcl-ark <will@256k1.dev>2024-03-21 10:29:43 +0000
commit69d6fd676e9c15ef41a03722d51ed0b13c3e4320 (patch)
tree63b7c42414436062bf7a05bd5b59ee776cecfc37 /src/bitcoin-cli.cpp
parentbf1b6383dbbfdd0c96a161d4693a48bf3a6b6150 (diff)
downloadbitcoin-69d6fd676e9c15ef41a03722d51ed0b13c3e4320.tar.xz
cli: improve bitcoin-cli error when not connected
Adds a string suggestion `bitcoin-cli -help` as an additional source of information.
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index f0e27cb675..129deeec60 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -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(