Skip to content

fix(rtc): raise ParticipantError when set_metadata, set_name or set_attributes fails - #969

Open
cloudwebrtc wants to merge 3 commits into
mainfrom
fix/rtc-participant-setter-errors
Open

cloudwebrtc wants to merge 3 commits into
mainfrom
fix/rtc-participant-setter-errors

Conversation

@cloudwebrtc

Copy link
Copy Markdown
Contributor

Supersedes #490 (rebased on main, with tests). The fix itself is the original commit from @mike-r-mclaughlin, kept with its authorship.

Problem

LocalParticipant.set_metadata(), set_name() and set_attributes() wait for their FFI callback but ignore its error field. When the update fails on the Rust side, for example because the participant lacks the canUpdateOwnMetadata permission, the call returns as if it had succeeded, and the caller has no way to tell.

Change

  • All three methods now raise ParticipantError (new, in livekit.rtc.participant) with the callback's error message when error is set.
  • The docstrings document the new Raises:.
  • A changeset (livekit-rtc: patch) notes the behavior change: code that relied on these calls never raising will now see the error.

Tests

tests/rtc/test_participant_setters.py mocks the FFI client and covers each setter with and without an error in the callback. The three error cases fail against main and pass with this change. ruff check, ruff format --check and mypy are clean.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread .changeset/participant-setter-errors.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

This PR bumps

  • livekit: patch

This branch has not been deployed

No deployments
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.

3 participants