aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-07-07 12:15:44 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-07-07 17:25:56 +0200
commit65ce0215a461318c5d7caf3f35cfeef947171a5a (patch)
treede017aa1b5cd6a343d6c9c70b58db43aebf636a2 /src/bitcoin-cli.cpp
parent086cb336cd8ac0b2a7ad9ff0544c014569c7db38 (diff)
downloadbitcoin-65ce0215a461318c5d7caf3f35cfeef947171a5a.tar.xz
[bitcoin-cli] improve error output
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index d451720141..903777ba51 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -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())