mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-28 06:50:38 +01:00
rpc: treat univalue type check error as RPC_TYPE_ERROR, not RPC_MISC_ERROR
By throwing a custom exception from `Univalue::checkType` (instead of a plain std::runtime_error) and catching it on the RPC server request handler. So we properly return RPC_TYPE_ERROR (-3) on arg type errors and not the general RPC_MISC_ERROR (-1).
This commit is contained in:
@@ -92,7 +92,7 @@ class HelpRpcTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-1, 'help', node.help, 'foo', 'bar')
|
||||
|
||||
# invalid argument
|
||||
assert_raises_rpc_error(-1, "JSON value of type number is not of expected type string", node.help, 0)
|
||||
assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", node.help, 0)
|
||||
|
||||
# help of unknown command
|
||||
assert_equal(node.help('foo'), 'help: unknown command: foo')
|
||||
|
||||
Reference in New Issue
Block a user