Skip to content

Commit 11576a5

Browse files
committed
Merge pull request #6387
65ce021 [bitcoin-cli] improve error output (Jonas Schnelli)
2 parents 6a73d66 + 65ce021 commit 11576a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bitcoin-cli.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ int CommandLineRPC(int argc, char *argv[])
190190
throw CConnectionFailed("server in warmup");
191191
strPrint = "error: " + error.write();
192192
nRet = abs(code);
193+
if (error.isObject())
194+
{
195+
UniValue errCode = find_value(error, "code");
196+
UniValue errMsg = find_value(error, "message");
197+
strPrint = errCode.isNull() ? "" : "error code: "+errCode.getValStr()+"\n";
198+
199+
if (errMsg.isStr())
200+
strPrint += "error message:\n"+errMsg.get_str();
201+
}
193202
} else {
194203
// Result
195204
if (result.isNull())

0 commit comments

Comments
 (0)