From 9d7deccc533289c42773b6be8f077a1058bef823 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 30 Aug 2023 17:54:58 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20handle=20and=20l?= =?UTF-8?q?og=20any=20exception=20that=20occurs=20in=20the=20chat=20websoc?= =?UTF-8?q?ket=20to=20prevent=20unhandled=20errors=20and=20provide=20bette?= =?UTF-8?q?r=20error=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 18c8a8a74..bd24806ff 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -59,6 +59,9 @@ async def chat( except WebSocketException as exc: logger.error(f"Websocket error: {exc}") await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc)) + except Exception as exc: + logger.error(f"Error in chat websocket: {exc}") + await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc)) @router.post("/build/init/{flow_id}", response_model=InitResponse, status_code=201)