diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2022-09-12 10:04:15 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2022-09-12 10:04:15 -0300 |
commit | 2870a97121ebeb4750a8d72cd5f39d9600767bc4 (patch) | |
tree | 102300a9ed5c5b73408ddc0fd0500252118370f6 /src | |
parent | 5558d2f5496d8fe1c16f9edd1ef395fcd842e6fb (diff) |
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.cpp | 3 |
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))); } } |