aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-09-12 10:04:15 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-09-12 10:04:15 -0300
commit2870a97121ebeb4750a8d72cd5f39d9600767bc4 (patch)
tree102300a9ed5c5b73408ddc0fd0500252118370f6 /src
parent5558d2f5496d8fe1c16f9edd1ef395fcd842e6fb (diff)
downloadbitcoin-2870a97121ebeb4750a8d72cd5f39d9600767bc4.tar.xz
RPC: unify arg type error message
We were throwing two different errors for the same problematic: * "Expected type {expected], got {type}" --> RPCTypeCheckArgument() * "JSON value of type {type} is not of expected type {expected}" --> UniValue::checkType()
Diffstat (limited to 'src')
-rw-r--r--src/rpc/util.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 24ab21a947..43935650fa 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -50,7 +50,8 @@ void RPCTypeCheck(const UniValue& params,
void RPCTypeCheckArgument(const UniValue& value, const UniValueType& typeExpected)
{
if (!typeExpected.typeAny && value.type() != typeExpected.type) {
- throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Expected type %s, got %s", uvTypeName(typeExpected.type), uvTypeName(value.type())));
+ throw JSONRPCError(RPC_TYPE_ERROR,
+ strprintf("JSON value of type %s is not of expected type %s", uvTypeName(value.type()), uvTypeName(typeExpected.type)));
}
}