mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-17 23:51:30 +00:00
resolve
This commit is contained in:
parent
31f1b47039
commit
8e046024fc
1 changed files with 0 additions and 13 deletions
|
|
@ -2710,20 +2710,7 @@ if MCP_AVAILABLE:
|
|||
await server.run(streams[0], streams[1], options)
|
||||
except Exception as session_e:
|
||||
verbose_logger.exception(f"Error in SSE session: {session_e}")
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
verbose_logger.exception(f"Error handling MCP request: {e}")
|
||||
# Instead of re-raising, try to send a graceful error response
|
||||
try:
|
||||
# Send a proper HTTP error response instead of letting the exception bubble up
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.status import HTTP_500_INTERNAL_SERVER_ERROR
|
||||
|
||||
error_response = JSONResponse(
|
||||
status_code=HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
content={"error": "MCP request failed", "details": str(e)},
|
||||
)
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue