File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change 1313from anyio .abc import TaskGroup
1414from anyio .streams .memory import MemoryObjectReceiveStream , MemoryObjectSendStream
1515from httpx_sse import EventSource , ServerSentEvent , aconnect_sse
16+ from pydantic import ValidationError
1617
1718from mcp .client ._transport import TransportStreams
1819from mcp .shared ._httpx_utils import create_mcp_http_client
@@ -311,7 +312,7 @@ async def _handle_json_response(
311312
312313 session_message = SessionMessage (message )
313314 await read_stream_writer .send (session_message )
314- except Exception as exc :
315+ except ( httpx . StreamError , ValidationError ) as exc :
315316 logger .exception ("Error parsing JSON response" )
316317 error_data = ErrorData (code = PARSE_ERROR , message = f"Failed to parse JSON response: { exc } " )
317318 error_msg = SessionMessage (JSONRPCError (jsonrpc = "2.0" , id = request_id , error = error_data ))
You can’t perform that action at this time.
0 commit comments