-
Notifications
You must be signed in to change notification settings - Fork 173
elevenlabs check if json.error exists and throws error #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
this helps finding the issue when elevenlabs is just silent and nothing is happening (e.g. out of credit or invalid voice)
🦋 Changeset detectedLatest commit: a832731 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| // skip log error for normal websocket close | ||
| if (err instanceof Error && !err.message.includes('WebSocket closed')) { | ||
| this.#logger.error({ err }, 'Error in listenTask from ElevenLabs WebSocket'); | ||
| throw err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could throw only on ElevenLabsError, but I can't see a reason why other errors should be "silently ignored"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to reuse classes defined here: https://github.com/livekit/agents-js/blob/34116a240ab20081107c3f47ea7a5391d5077afc/agents/src/_exceptions.ts?
| body?: unknown; | ||
| }) { | ||
| super(buildMessage({ message, statusCode, body })); | ||
| Object.setPrototypeOf(this, ElevenLabsError.prototype); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this line for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a pattern I use all the time to make it easy to check of the instance of this error...e.g. error instanceOf ElevenlabsError, without this construct this doesn't evaluate to true.
Maybe this is not needed nowadays anymore,guess it depends on the transpile&runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Maybe add a 1 line comments to make it better understandable.
|
Hey @simllll, just checking in, are you still working on this PR? We have a customer requesting this feature. If you're tied up with something else, I’m happy to take it over from here! |
|
@toubatbrian feel free to take over :-) I'm away for a few days and only on my phone. |
Description
this helps finding the issue when elevenlabs is just silent and nothing is happening (e.g. out of credit or invalid voice)
Changes Made
Pre-Review Checklist
Testing
restaurant_agent.tsandrealtime_agent.tswork properly (for major changes)Additional Notes
Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.