aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-08-02 19:19:53 -0400
committerAndrew Chow <achow101-github@achow101.com>2019-08-16 19:34:01 -0400
commit625534d7b1417da926f1ced600855ea818d6e01e (patch)
treeb7ec5d310f4f2e169e57516c0032ff0c98156833 /src/rpc/misc.cpp
parentc325f619dd071b5489989f645e42cace8eb23fb4 (diff)
downloadbitcoin-625534d7b1417da926f1ced600855ea818d6e01e.tar.xz
Give more errors for specific failure conditions
Some failure conditions implicitly fail by failing some other check. But the error messages are more helpful if they say explicitly what actually caused the failure, so add those as failure conditions and errors.
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r--src/rpc/misc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index e48ed8db75..1516007201 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -153,7 +153,7 @@ UniValue getdescriptorinfo(const JSONRPCRequest& request)
std::string error;
auto desc = Parse(request.params[0].get_str(), provider, error);
if (!desc) {
- throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid descriptor, %s", error));
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, error);
}
UniValue result(UniValue::VOBJ);
@@ -203,7 +203,7 @@ UniValue deriveaddresses(const JSONRPCRequest& request)
std::string error;
auto desc = Parse(desc_str, key_provider, error, /* require_checksum = */ true);
if (!desc) {
- throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid descriptor, %s", error));
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, error);
}
if (!desc->IsRange() && request.params.size() > 1) {