tests: log node JSON-RPC errors during test setup

Currently, if the node replies to any command with an error during
the test framework's setup(), we log the generic and not really useful
"Unexpected exception" from the BaseException catch, with no further
information.
This isn't helpful for diagnosing the issue. Fix it by explicitly handling
JSONRPCException and logging the response error message and http status
code.
This commit is contained in:
furszy 2026-01-27 20:59:33 -05:00
parent 45930a7941
commit 6354b4fd7f
No known key found for this signature in database
GPG Key ID: 5DD23CCC686AA623

View File

@ -147,6 +147,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
except subprocess.CalledProcessError as e:
self.log.exception(f"Called Process failed with stdout='{e.stdout}'; stderr='{e.stderr}';")
self.success = TestStatus.FAILED
except JSONRPCException as e:
self.log.exception(f"Failure during setup: error={e.error}, http_status={e.http_status}")
self.success = TestStatus.FAILED
except BaseException:
self.log.exception("Unexpected exception")
self.success = TestStatus.FAILED