mirror of https://github.com/nucypher/nucypher.git
Catch TypeError instead of Exception when checking ability to serialize to JSON.
parent
1953e80be0
commit
bae37d4336
|
@ -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:
|
||||||
|
|
|
@ -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)}"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue