Browse Source

Merge pull request #6387

65ce021 [bitcoin-cli] improve error output (Jonas Schnelli)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
11576a57d2
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 9
      src/bitcoin-cli.cpp

9
src/bitcoin-cli.cpp

@ -190,6 +190,15 @@ int CommandLineRPC(int argc, char *argv[]) @@ -190,6 +190,15 @@ int CommandLineRPC(int argc, char *argv[])
throw CConnectionFailed("server in warmup");
strPrint = "error: " + error.write();
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 {
// Result
if (result.isNull())

Loading…
Cancel
Save