RPC: make RPCResult::MatchesType return useful errors

This commit is contained in:
Anthony Towns
2023-01-13 20:27:59 +10:00
parent f4ef856375
commit 3d1a4d8a45
2 changed files with 79 additions and 33 deletions

View File

@@ -324,8 +324,10 @@ struct RPCResult {
std::string ToStringObj() const;
/** Return the description string, including the result type. */
std::string ToDescriptionString() const;
/** Check whether the result JSON type matches. */
bool MatchesType(const UniValue& result) const;
/** Check whether the result JSON type matches.
* Returns true if type matches, or object describing error(s) if not.
*/
UniValue MatchesType(const UniValue& result) const;
private:
void CheckInnerDoc() const;