tweak _validate_json
@@ -276,9 +276,7 @@ class Field:
def _validate_json(self, v, loc):
try:
return Json.validate(v), None
- except ValueError as exc:
- return v, ErrorWrapper(exc, loc=loc, config=self.model_config)
- except TypeError as exc:
+ except (ValueError, TypeError) as exc:
return v, ErrorWrapper(exc, loc=loc, config=self.model_config)
def _validate_sequence(self, v, values, loc, cls):
