diff options
| author | Jonas Schnelli <[email protected]> | 2015-07-07 12:15:44 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2015-07-07 17:25:56 +0200 |
| commit | 65ce0215a461318c5d7caf3f35cfeef947171a5a (patch) | |
| tree | de017aa1b5cd6a343d6c9c70b58db43aebf636a2 /src/bitcoin-cli.cpp | |
| parent | Merge pull request #6365 (diff) | |
| download | discoin-65ce0215a461318c5d7caf3f35cfeef947171a5a.tar.xz discoin-65ce0215a461318c5d7caf3f35cfeef947171a5a.zip | |
[bitcoin-cli] improve error output
Diffstat (limited to 'src/bitcoin-cli.cpp')
| -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 d45172014..903777ba5 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()) |