aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorLeonardo Araujo <leonardo.aa88@gmail.com>2022-10-04 13:51:24 -0300
committerLeonardo Araujo <leonardo.aa88@gmail.com>2022-10-10 18:08:00 -0300
commit2dede9f67596787e18904d3d5961f48ec75f241e (patch)
tree81472b4316cf093e3abcf3c61a526c3d1c346e46 /src/rpc
parent9ca39d69dfe03c19662867c3d53a5e6e41277d4a (diff)
Adjust RPCTypeCheckObj error string
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/util.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 3e98e89791..dd5739faf7 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -65,11 +65,8 @@ void RPCTypeCheckObj(const UniValue& o,
if (!fAllowNull && v.isNull())
throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first));
- if (!(t.second.typeAny || v.type() == t.second.type || (fAllowNull && v.isNull()))) {
- std::string err = strprintf("Expected type %s for %s, got %s",
- uvTypeName(t.second.type), t.first, uvTypeName(v.type()));
- throw JSONRPCError(RPC_TYPE_ERROR, err);
- }
+ if (!(t.second.typeAny || v.type() == t.second.type || (fAllowNull && v.isNull())))
+ throw JSONRPCError(RPC_TYPE_ERROR, strprintf("JSON value of type %s for field %s is not of expected type %s", uvTypeName(v.type()), t.first, uvTypeName(t.second.type)));
}
if (fStrict)