File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -550,10 +550,27 @@ async def monitor_pause() -> None:
550550 ),
551551 inner_messages = inner_messages ,
552552 )
553+ except Exception as e :
554+ logger .error (f"Error in CoderAgent: { e } " )
555+ # add to chat history
556+ self ._chat_history .append (
557+ TextMessage (
558+ content = f"An error occurred while executing the code: { e } " ,
559+ source = self .name ,
560+ )
561+ )
562+ yield Response (
563+ chat_message = TextMessage (
564+ content = "An error occurred while executing the code." ,
565+ source = self .name ,
566+ metadata = {"internal" : "no" },
567+ ),
568+ inner_messages = inner_messages ,
569+ )
553570 finally :
554571 # Cancel the monitor task.
555- monitor_pause_task .cancel ()
556572 try :
573+ monitor_pause_task .cancel ()
557574 await monitor_pause_task
558575 except asyncio .CancelledError :
559576 pass
You can’t perform that action at this time.
0 commit comments