@@ -459,30 +459,6 @@ async def handler(req: types.CompleteRequest):
459459
460460 return decorator
461461
462- async def _handle_message (
463- self ,
464- message : RequestResponder [types .ClientRequest , types .ServerResult ]
465- | types .ClientNotification
466- | Exception ,
467- session : ServerSession ,
468- lifespan_context : LifespanResultT ,
469- raise_exceptions : bool = False ,
470- ):
471- with warnings .catch_warnings (record = True ) as w :
472- match message :
473- case (
474- RequestResponder (request = types .ClientRequest (root = req )) as responder
475- ):
476- with responder :
477- await self ._handle_request (
478- message , req , session , lifespan_context , raise_exceptions
479- )
480- case types .ClientNotification (root = notify ):
481- await self ._handle_notification (notify )
482-
483- for warning in w :
484- logger .info (f"Warning: { warning .category .__name__ } : { warning .message } " )
485-
486462 async def run (
487463 self ,
488464 read_stream : MemoryObjectReceiveStream [types .JSONRPCMessage | Exception ],
@@ -512,6 +488,30 @@ async def run(
512488 raise_exceptions ,
513489 )
514490
491+ async def _handle_message (
492+ self ,
493+ message : RequestResponder [types .ClientRequest , types .ServerResult ]
494+ | types .ClientNotification
495+ | Exception ,
496+ session : ServerSession ,
497+ lifespan_context : LifespanResultT ,
498+ raise_exceptions : bool = False ,
499+ ):
500+ with warnings .catch_warnings (record = True ) as w :
501+ match message :
502+ case (
503+ RequestResponder (request = types .ClientRequest (root = req )) as responder
504+ ):
505+ with responder :
506+ await self ._handle_request (
507+ message , req , session , lifespan_context , raise_exceptions
508+ )
509+ case types .ClientNotification (root = notify ):
510+ await self ._handle_notification (notify )
511+
512+ for warning in w :
513+ logger .info (f"Warning: { warning .category .__name__ } : { warning .message } " )
514+
515515 async def _handle_request (
516516 self ,
517517 message : RequestResponder ,
0 commit comments