From d28d0fa21834a30e32e89ed527ff01c29c90830e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 13 May 2024 16:12:35 -0700 Subject: [PATCH] processors: add FrameProcessor.push_error --- src/pipecat/processors/frame_processor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index 02ca62ea8..3bb750218 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -8,7 +8,7 @@ import asyncio from asyncio import AbstractEventLoop from enum import Enum -from pipecat.frames.frames import Frame +from pipecat.frames.frames import ErrorFrame, Frame from pipecat.utils.utils import obj_count, obj_id from loguru import logger @@ -42,6 +42,9 @@ class FrameProcessor: async def process_frame(self, frame: Frame, direction: FrameDirection): pass + async def push_error(self, error: ErrorFrame): + await self.push_frame(error, FrameDirection.UPSTREAM) + async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM): if direction == FrameDirection.DOWNSTREAM and self._next: logger.trace(f"Pushing {frame} from {self} to {self._next}")