Skip to content

Commit

Permalink
fix: add general error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloGiacco committed Jan 30, 2025
1 parent d4ce551 commit a313677
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/elevenlabs/conversational_ai/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ def input_callback(audio):
)
except ConnectionClosedOK:
self.end_session()
except Exception as e:
print(f"Error sending user audio chunk: {e}")
self.end_session()

self.audio_interface.start(input_callback)
while not self._should_stop.is_set():
Expand All @@ -307,6 +310,9 @@ def input_callback(audio):
self.end_session()
except TimeoutError:
pass
except Exception as e:
print(f"Error receiving message: {e}")
self.end_session()

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

0 comments on commit a313677

Please sign in to comment.