From f061578b8f0e3c882a4a55c31fa307f92350218a Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Tue, 7 Jul 2015 12:15:44 +0200 Subject: [PATCH] [bitcoin-cli] improve error output --- src/bitcoin-cli.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 6e54cd97a..0e692622b 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -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())