Catch TypeError instead of Exception when checking ability to serialize to JSON.

pull/3313/head
derekpierre 2023-10-26 08:01:59 -04:00 committed by KPrasch
parent 1953e80be0
commit bae37d4336
2 changed files with 2 additions and 1 deletions

View File

@ -356,6 +356,7 @@ class ContractCondition(RPCCondition):
super().__init__(condition_type=condition_type, method=method, *args, **kwargs) super().__init__(condition_type=condition_type, method=method, *args, **kwargs)
def _validate_method(self, method): def _validate_method(self, method):
# overrides validate method used by rpc superclass
return method return method
def _validate_expected_return_type(self) -> None: def _validate_expected_return_type(self) -> None:

View File

@ -245,7 +245,7 @@ class ReturnValueTest:
try: try:
json.dumps(value) json.dumps(value)
except Exception: except TypeError:
raise self.InvalidExpression( raise self.InvalidExpression(
f"No JSON serializable equivalent found for type {type(value)}" f"No JSON serializable equivalent found for type {type(value)}"
) )