rpc: Throw more user friendly arg type check error

This commit is contained in:
MarcoFalke
2023-01-20 12:50:25 +01:00
parent eebc24bfc6
commit fafeddfe0e
3 changed files with 51 additions and 33 deletions

View File

@@ -62,11 +62,6 @@ struct UniValueType {
UniValue::VType type;
};
/**
* Type-check one argument; throws JSONRPCError if wrong type given.
*/
void RPCTypeCheckArgument(const UniValue& value, const UniValueType& typeExpected);
/*
Check for expected keys/value types in an Object.
*/
@@ -214,8 +209,11 @@ struct RPCArg {
bool IsOptional() const;
/** Check whether the request JSON type matches. */
void MatchesType(const UniValue& request) const;
/**
* Check whether the request JSON type matches.
* Returns true if type matches, or object describing error(s) if not.
*/
UniValue MatchesType(const UniValue& request) const;
/** Return the first of all aliases */
std::string GetFirstName() const;