elevenlabs check if json.error exists and throws error#787
elevenlabs check if json.error exists and throws error#787simllll wants to merge 3 commits intolivekit:mainfrom
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.
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.
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.
What's this line for?
There was a problem hiding this comment.
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.
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.