processors(rtvi): fix send_error()
This commit is contained in:
@@ -301,8 +301,8 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
async def interrupt_bot(self):
|
async def interrupt_bot(self):
|
||||||
await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM)
|
await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM)
|
||||||
|
|
||||||
async def send_error(self, frame: ErrorFrame):
|
async def send_error(self, error: str):
|
||||||
message = RTVIError(data=RTVIErrorData(message=frame.error, fatal=frame.fatal))
|
message = RTVIError(data=RTVIErrorData(error=error, fatal=False))
|
||||||
await self._push_transport_message(message)
|
await self._push_transport_message(message)
|
||||||
|
|
||||||
async def handle_function_call(
|
async def handle_function_call(
|
||||||
@@ -338,7 +338,7 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
await self._cancel(frame)
|
await self._cancel(frame)
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
elif isinstance(frame, ErrorFrame):
|
elif isinstance(frame, ErrorFrame):
|
||||||
await self.send_error(frame)
|
await self._send_error_frame(frame)
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
# All other system frames
|
# All other system frames
|
||||||
elif isinstance(frame, SystemFrame):
|
elif isinstance(frame, SystemFrame):
|
||||||
@@ -586,6 +586,10 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
config=self._config.config))
|
config=self._config.config))
|
||||||
await self._push_transport_message(message)
|
await self._push_transport_message(message)
|
||||||
|
|
||||||
|
async def _send_error_frame(self, frame: ErrorFrame):
|
||||||
|
message = RTVIError(data=RTVIErrorData(error=frame.error, fatal=frame.fatal))
|
||||||
|
await self._push_transport_message(message)
|
||||||
|
|
||||||
async def _send_error_response(self, id: str, error: str):
|
async def _send_error_response(self, id: str, error: str):
|
||||||
message = RTVIErrorResponse(id=id, data=RTVIErrorResponseData(error=error))
|
message = RTVIErrorResponse(id=id, data=RTVIErrorResponseData(error=error))
|
||||||
await self._push_transport_message(message)
|
await self._push_transport_message(message)
|
||||||
|
|||||||
Reference in New Issue
Block a user