Skip to content

Commit

Permalink
[bitcoin-cli] improve error output
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli authored and str4d committed Mar 3, 2017
1 parent a79c8e2 commit f061578
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,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())
Expand Down

0 comments on commit f061578

Please sign in to comment.