Page MenuHomePhabricator

rpc: treat univalue type check error as RPC_TYPE_ERROR, not RPC_MISC_ERROR
ClosedPublic

Authored by Fabien on Jun 5 2024, 19:34.

Details

Summary
Throw a custom exception from Univalue::checkType (instead of a plain
std::runtime_error) and catch it on the RPC server request handler.

So we properly return RPC_TYPE_ERROR (-3) on every arg type error and
not the general RPC_MISC_ERROR (-1).

This will allow us to remove all the RPCTypeCheckArgument calls. As them are redundant since #25629.

Backport of core#25737.

Depends on D16289.

Test Plan
ninja all check-all