From fd2a629971c931f85ab817a5e4611088232462c0 Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Wed, 29 Oct 2025 19:21:53 +0000 Subject: [PATCH] remove previous attempt at centralized `Exception` handling --- cognee/api/client.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/cognee/api/client.py b/cognee/api/client.py index 1d2c37131..1989978ef 100644 --- a/cognee/api/client.py +++ b/cognee/api/client.py @@ -187,29 +187,6 @@ async def exception_handler(_: Request, exc: CogneeApiError) -> JSONResponse: return JSONResponse(status_code=status_code, content={"detail": detail["message"]}) -@app.exception_handler(Exception) -async def global_exception_handler(request: Request, exc: Exception) -> JSONResponse: - """ - Global exception handler for all unhandled exceptions. - Logs the full stack trace and returns a 500 error with details. - """ - print(f"🔴 GLOBAL EXCEPTION HANDLER CALLED: {type(exc).__name__}") - logger.exception( - f"Unhandled exception in {request.method} {request.url.path}: " - f"{type(exc).__name__}: {str(exc)}" - ) - - return JSONResponse( - status_code=403, - content={ - "error": str(exc), - "error_type": type(exc).__name__, - "message": "An internal server error occurred. Please check server logs for details.", - "path": request.url.path, - }, - ) - - @app.get("/") async def root(): """