MCPcopy Create free account
hub / github.com/Nativu5/Gemini-FastAPI / global_exception_handler

Function global_exception_handler

app/server/middleware.py:71–81  ·  view source on GitHub ↗
(request: Request, exc: Exception)

Source from the content-addressed store, hash-verified

69
70
71def global_exception_handler(request: Request, exc: Exception):
72 if isinstance(exc, HTTPException):
73 return JSONResponse(
74 status_code=exc.status_code,
75 content={"error": {"message": exc.detail}},
76 )
77
78 return JSONResponse(
79 status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
80 content={"error": {"message": str(exc)}},
81 )
82
83
84def get_temp_dir():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected