Skip to content

Commit 6c21122

Browse files
pblazejclaude
andcommitted
fix(data-tracks): handle PushFrameErrorReason associated values
The 0.31.2 bindings give PushFrameErrorReason cases an associated `message: String` and conform it to Swift.Error, so `catch PushFrameErrorReason.QueueFull` no longer matches. Catch the error and pattern-match the case, rethrowing other variants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 17a41e5 commit 6c21122

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Sources/LiveKit/Participant/LocalParticipant+DataTrack.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,16 @@ extension LocalDataTrack {
6565
/// Sends frames from the source until it ends or the track is unpublished.
6666
func send<S: AsyncSequence>(
6767
contentsOf source: S,
68-
onQueueFull: FrameDropPolicy = .drop
68+
onQueueFull: FrameDropPolicy = .drop,
6969
) async throws where S.Element == DataTrackFrame {
7070
for try await frame in source {
7171
guard isPublished() else { break }
7272
do {
7373
try tryPush(frame: frame)
74-
} catch PushFrameErrorReason.QueueFull {
74+
} catch let error as PushFrameErrorReason {
75+
guard case .QueueFull = error else { throw error }
7576
switch onQueueFull {
76-
case .throw: throw PushFrameErrorReason.QueueFull
77+
case .throw: throw error
7778
case .drop: continue
7879
}
7980
}

0 commit comments

Comments
 (0)