File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -400,17 +400,22 @@ async def post_writer(
400400 sse_read_timeout = self .sse_read_timeout ,
401401 )
402402
403- async def handle_request_async ():
404- if is_resumption :
405- await self ._handle_resumption_request (ctx )
406- else :
407- await self ._handle_post_request (ctx )
403+ async def handle_request_async (ctx : RequestContext , is_resumption : bool ) -> None :
404+ try :
405+ if is_resumption :
406+ await self ._handle_resumption_request (ctx )
407+ else :
408+ await self ._handle_post_request (ctx )
409+ except Exception as e :
410+ # Send error to read stream so client knows request failed
411+ logger .error ("Request handler error: %s" , e )
412+ await ctx .read_stream_writer .send (e )
408413
409414 # If this is a request, start a new task to handle it
410415 if isinstance (message .root , JSONRPCRequest ):
411- tg .start_soon (handle_request_async )
416+ tg .start_soon (handle_request_async , ctx , is_resumption )
412417 else :
413- await handle_request_async ()
418+ await handle_request_async (ctx , is_resumption )
414419
415420 except Exception :
416421 logger .exception ("Error in post_writer" )
You can’t perform that action at this time.
0 commit comments