diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 903dd1b2b5b..c35d41124dd 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -101,10 +101,9 @@ def assert_raises_message(exc, message, fun, *args, **kwds): except JSONRPCException: raise AssertionError("Use assert_raises_rpc_error() to test RPC failures") except exc as e: - 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 message is not None and message not in repr(e): + raise AssertionError("Expected substring not found in exception:\n" + f"substring: '{message}'\nexception: {repr(e)}.") except Exception as e: raise AssertionError("Unexpected exception raised: " + type(e).__name__) else: