4444 TaskPushNotificationConfig ,
4545)
4646from a2a .utils .constants import PROTOCOL_VERSION_0_3 , VERSION_HEADER
47- from a2a .utils .errors import (
48- A2A_REASON_TO_ERROR ,
49- JSON_RPC_ERROR_CODE_MAP ,
50- MethodNotFoundError ,
51- )
47+ from a2a .utils .errors import JSON_RPC_ERROR_CODE_MAP , MethodNotFoundError
5248from a2a .utils .telemetry import SpanKind , trace_class
5349
5450
@@ -373,30 +369,6 @@ def _handle_http_error(self, e: httpx.HTTPStatusError) -> NoReturn:
373369
374370 raise A2AClientError (f'HTTP Error { status_code } : { e } ' ) from e
375371
376- def _handle_sse_error (self , sse_data : str ) -> NoReturn :
377- """Handles SSE error events by parsing the REST error payload and raising the appropriate A2AError."""
378- error_payload = json .loads (sse_data )
379- error_data = error_payload .get ('error' , {})
380-
381- message = error_data .get ('message' , sse_data )
382- details = error_data .get ('details' , [])
383- if not isinstance (details , list ):
384- details = []
385-
386- for d in details :
387- if (
388- isinstance (d , dict )
389- and d .get ('@type' ) == 'type.googleapis.com/google.rpc.ErrorInfo'
390- ):
391- reason = d .get ('reason' )
392- if isinstance (reason , str ):
393- exception_cls = A2A_REASON_TO_ERROR .get (reason )
394- if exception_cls :
395- raise exception_cls (message )
396- break
397-
398- raise A2AClientError (message )
399-
400372 async def _send_stream_request (
401373 self ,
402374 method : str ,
@@ -414,7 +386,6 @@ async def _send_stream_request(
414386 method ,
415387 f'{ self .url } { path } ' ,
416388 self ._handle_http_error ,
417- self ._handle_sse_error ,
418389 json = json ,
419390 ** http_kwargs ,
420391 ):
0 commit comments