diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-07-07 12:15:44 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-07-07 17:25:56 +0200 |
commit | 65ce0215a461318c5d7caf3f35cfeef947171a5a (patch) | |
tree | de017aa1b5cd6a343d6c9c70b58db43aebf636a2 | |
parent | 086cb336cd8ac0b2a7ad9ff0544c014569c7db38 (diff) |
[bitcoin-cli] improve error output
-rw-r--r-- | src/bitcoin-cli.cpp | 9 |
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()) |