Skip to content

Commit

Permalink
Merge pull request #6387
Browse files Browse the repository at this point in the history
65ce021 [bitcoin-cli] improve error output (Jonas Schnelli)
  • Loading branch information
laanwj committed Jul 8, 2015
2 parents 6a73d66 + 65ce021 commit 11576a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bitcoin-cli.cpp
Expand Up @@ -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())
Expand Down

0 comments on commit 11576a5

Please sign in to comment.