| 30 | logger = logging.getLogger("TestFramework.utils") |
| 31 | |
| 32 | class JSONRPCException(Exception): |
| 33 | def __init__(self, rpc_error, http_status=None): |
| 34 | self.error = rpc_error |
| 35 | self.http_status = http_status |
| 36 | |
| 37 | # throw KeyError if any required fields are missing |
| 38 | copied_error = copy(rpc_error) |
| 39 | message = copied_error.pop("message") |
| 40 | code = copied_error.pop("code") |
| 41 | extra = f'{copied_error}' if copied_error else '' |
| 42 | super().__init__(f"{message} ({code}) {extra} [http_status={http_status}]") |
| 43 | |
| 44 | # Assert functions |
| 45 | ################## |
no outgoing calls