Skip to content

Conversation

@simllll
Copy link

@simllll simllll commented Oct 24, 2025

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

  1. added check for ".error"
  2. throw error and not just ignore it (not sure why this was initially like this?)

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included

Testing

  • Automated tests added/updated (if applicable)
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes


Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.

this helps finding the issue when elevenlabs is just silent and nothing is happening (e.g. out of credit or invalid voice)
@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: a832731

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@livekit/agents-plugin-elevenlabs Patch

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

@simllll simllll marked this pull request as ready for review October 24, 2025 14:54
@simllll simllll changed the title check if json.error exists and throws error elevenlabs check if json.error exists and throws error Oct 24, 2025
// 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;
Copy link
Author

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"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body?: unknown;
}) {
super(buildMessage({ message, statusCode, body }));
Object.setPrototypeOf(this, ElevenLabsError.prototype);
Copy link
Contributor

@toubatbrian toubatbrian Nov 6, 2025

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?

Copy link
Author

@simllll simllll Nov 6, 2025

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.

Copy link
Contributor

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.

@toubatbrian
Copy link
Contributor

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!

@simllll
Copy link
Author

simllll commented Nov 6, 2025

@toubatbrian feel free to take over :-) I'm away for a few days and only on my phone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants