Merge pull request #6387
65ce021
[bitcoin-cli] improve error output (Jonas Schnelli)
This commit is contained in:
commit
11576a57d2
1 changed files with 9 additions and 0 deletions
|
@ -190,6 +190,15 @@ int CommandLineRPC(int argc, char *argv[])
|
||||||
throw CConnectionFailed("server in warmup");
|
throw CConnectionFailed("server in warmup");
|
||||||
strPrint = "error: " + error.write();
|
strPrint = "error: " + error.write();
|
||||||
nRet = abs(code);
|
nRet = abs(code);
|
||||||
|
if (error.isObject())
|
||||||
|
{
|
||||||
|
UniValue errCode = find_value(error, "code");
|
||||||
|
UniValue errMsg = find_value(error, "message");
|
||||||
|
strPrint = errCode.isNull() ? "" : "error code: "+errCode.getValStr()+"\n";
|
||||||
|
|
||||||
|
if (errMsg.isStr())
|
||||||
|
strPrint += "error message:\n"+errMsg.get_str();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Result
|
// Result
|
||||||
if (result.isNull())
|
if (result.isNull())
|
||||||
|
|
Loading…
Reference in a new issue