From 3fde8880f275f584189a2280fa060eb147594ef8 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Mon, 23 Jun 2025 18:47:54 -0300 Subject: [PATCH] Fixed a couple of places inside the FrameProcessor where we should not raise the exceptions. --- src/pipecat/processors/frame_processor.py | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index 1d2f066ed..b73fb0e9f 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -315,9 +315,8 @@ class FrameProcessor(BaseObject): # Cancel the input task. This will stop processing queued frames. await self.__cancel_input_task() except Exception as e: - logger.exception(f"Uncaught exception in {self}: {e}") + logger.exception(f"Uncaught exception in {self} when handling _start_interruption: {e}") await self.push_error(ErrorFrame(str(e))) - raise # Create a new input queue and task. self.__create_input_task() @@ -360,7 +359,6 @@ class FrameProcessor(BaseObject): except Exception as e: logger.exception(f"Uncaught exception in {self}: {e}") await self.push_error(ErrorFrame(str(e))) - raise def _check_started(self, frame: Frame): if not self.__started: @@ -389,15 +387,17 @@ class FrameProcessor(BaseObject): logger.trace(f"{self}: frame processing resumed") (frame, direction, callback) = await self.__input_queue.get() - - # Process the frame. - await self.process_frame(frame, direction) - - # If this frame has an associated callback, call it now. - if callback: - await callback(self, frame, direction) - - self.__input_queue.task_done() + try: + # Process the frame. + await self.process_frame(frame, direction) + # If this frame has an associated callback, call it now. + if callback: + await callback(self, frame, direction) + except Exception as e: + logger.exception(f"{self}: error processing frame: {e}") + await self.push_error(ErrorFrame(str(e))) + finally: + self.__input_queue.task_done() def __create_push_task(self): if not self.__push_frame_task: