Permalink
Browse files

Merge pull request #6387

65ce021 [bitcoin-cli] improve error output (Jonas Schnelli)
  • Loading branch information...
laanwj committed Jul 8, 2015
2 parents 6a73d66 + 65ce021 commit 11576a57d2ee37aa421e0fce69e70751b5af9a61
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/bitcoin-cli.cpp
View
@@ -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())

0 comments on commit 11576a5

Please sign in to comment.