mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-31 10:41:08 +00:00
test: switch order of error code and message check
I feel it'd be easier to debug intermittent test failures if the error message is present in the logs instead of error code. So, switching order of error code and message in the `try_rpc` function to aid error debugging.
This commit is contained in:
parent
8c07800b19
commit
0aba464ce7
@ -165,13 +165,13 @@ def try_rpc(code, message, fun, *args, **kwds):
|
||||
try:
|
||||
fun(*args, **kwds)
|
||||
except JSONRPCException as e:
|
||||
# JSONRPCException was thrown as expected. Check the code and message values are correct.
|
||||
if (code is not None) and (code != e.error["code"]):
|
||||
raise AssertionError("Unexpected JSONRPC error code %i" % e.error["code"])
|
||||
# JSONRPCException was thrown as expected. Check the message and code values are correct.
|
||||
if (message is not None) and (message not in e.error['message']):
|
||||
raise AssertionError(
|
||||
"Expected substring not found in error message:\nsubstring: '{}'\nerror message: '{}'.".format(
|
||||
message, e.error['message']))
|
||||
if (code is not None) and (code != e.error["code"]):
|
||||
raise AssertionError("Unexpected JSONRPC error code %i" % e.error["code"])
|
||||
return True
|
||||
except Exception as e:
|
||||
raise AssertionError("Unexpected exception raised: " + type(e).__name__)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user