From a704d7e51439b56f0f3c034248efbec806f8504c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20S=C3=A1nchez=20Castro?= <72013291+JavierSanchezCastro@users.noreply.github.com> Date: Mon, 24 Nov 2025 01:02:29 +0100 Subject: [PATCH] Add RequestMalformedError exception class --- fastapi/exceptions.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)