diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py index 0620428be..a614874e8 100644 --- a/fastapi/exceptions.py +++ b/fastapi/exceptions.py @@ -162,6 +162,12 @@ class ValidationException(Exception): return self._errors +class RequestMalformedError(ValidationException): + def __init__(self, errors: Sequence[Any], *, body: Any = None) -> None: + super().__init__(errors) + self.body = body + + class RequestValidationError(ValidationException): def __init__(self, errors: Sequence[Any], *, body: Any = None) -> None: super().__init__(errors)