diff --git a/fastapi/routing.py b/fastapi/routing.py index 80bd53279a31f..8f4d0fa7ef578 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -209,7 +209,9 @@ async def app(request: Request) -> Response: else: body = body_bytes except json.JSONDecodeError as e: - raise RequestValidationError([ErrorWrapper(e, ("body", e.pos))], body=e.doc) + raise RequestValidationError( + [ErrorWrapper(e, ("body", e.pos))], body=e.doc + ) from e except Exception as e: raise HTTPException( status_code=400, detail="There was an error parsing the body"