mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 22:08:58 +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:
@@ -415,7 +415,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-3, "Invalid amount", self.nodes[0].sendtoaddress, self.nodes[2].getnewaddress(), "1f-4")
|
||||
|
||||
# This will raise an exception since generate does not accept a string
|
||||
assert_raises_rpc_error(-1, "not of expected type number", self.generate, self.nodes[0], "2")
|
||||
assert_raises_rpc_error(-3, "not of expected type number", self.generate, self.nodes[0], "2")
|
||||
|
||||
if not self.options.descriptors:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user