Skip to content

Commit 4c5639c

Browse files
AngeloGiaccolouisjoecodes
authored andcommitted
fix: add general error handling
1 parent d4ce551 commit 4c5639c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/elevenlabs/conversational_ai/conversation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ def input_callback(audio):
295295
)
296296
except ConnectionClosedOK:
297297
self.end_session()
298+
except Exception as e:
299+
print(f"Error sending user audio chunk: {e}")
300+
self.end_session()
298301

299302
self.audio_interface.start(input_callback)
300303
while not self._should_stop.is_set():
@@ -307,6 +310,9 @@ def input_callback(audio):
307310
self.end_session()
308311
except TimeoutError:
309312
pass
313+
except Exception as e:
314+
print(f"Error receiving message: {e}")
315+
self.end_session()
310316

311317
def _handle_message(self, message, ws):
312318
if message["type"] == "conversation_initiation_metadata":

0 commit comments

Comments
 (0)