From 30b587e5647e308dbec2ebdf394595f7f2c9c5de Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sat, 28 Dec 2024 15:53:27 +0300 Subject: [PATCH] fix --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 37fbb92..e8b57d4 100644 --- a/main.py +++ b/main.py @@ -14,6 +14,13 @@ app.include_router(take.router) app.include_router(put.router) app.include_router(finish.router) +@app.exception_handler(Exception) +async def unicorn_exception_handler(request: fastapi.Request, exc: Exception): + return fastapi.JSONResponse( + status_code=500, + content={"message": f"Oops! {exc.name} did something. There goes a rainbow... {exc}"}, + ) + mongo.create_indexes()