From 497692eece09d28ae537e63e410e515869214b4c Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Mon, 12 Aug 2024 07:10:11 +0000 Subject: [PATCH] Use exception args --- fastagency/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastagency/app.py b/fastagency/app.py index bbac55e0d..9c88d6ad7 100644 --- a/fastagency/app.py +++ b/fastagency/app.py @@ -46,7 +46,7 @@ async def handle_keynotfounderror_middleware( try: return await call_next(request) except KeyNotFoundError as e: - return JSONResponse(status_code=404, content={"detail": str(e)}) + return JSONResponse(status_code=404, content={"detail": e.args[0]}) @app.get("/models/schemas")