diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-01-20 10:37:17 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-01-20 10:37:23 +0100 |
commit | eebc24bfc6d2d809952e27c7fe269452f319455f (patch) | |
tree | e375443494ed6f354fbbb44a607da26f946e9f04 /src/rpc/util.h | |
parent | 58da1619be7ac13e686cb8bbfc2ab0f836eb3fa5 (diff) | |
parent | 3d1a4d8a45cd91bdfe0ef107c2e9c5e882b34155 (diff) |
Merge bitcoin/bitcoin#26887: RPC: make RPCResult::MatchesType return useful errors
3d1a4d8a45cd91bdfe0ef107c2e9c5e882b34155 RPC: make RPCResult::MatchesType return useful errors (Anthony Towns)
Pull request description:
Currently if you don't correctly update the description of the return value for an RPC call, you essentially just get an assertion failure with no useful information; this generates a description of the problems instead.
ACKs for top commit:
MarcoFalke:
re-ACK 3d1a4d8a45cd91bdfe0ef107c2e9c5e882b34155 🌷
Tree-SHA512: cf0580b7046faab0128672a74f8cc5a1655dfdca6646a2e38b51f0fb5f672c98aad6cd4c5769454a2d644a67da639ccb1c8ff5d24d3d6b4446a082398a643722
Diffstat (limited to 'src/rpc/util.h')
-rw-r--r-- | src/rpc/util.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rpc/util.h b/src/rpc/util.h index 30c46bfdcd..27363eeb50 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -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; |