Skip to content

Commit 29b5a15

Browse files
Pass abort reason directly instead of wrapping in Error
1 parent 608f59b commit 29b5a15

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/livekit-rtc/src/ffi_client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ export class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClient
9292
// the room disconnects or the operation is cancelled.
9393
const onAbort = () => {
9494
cleanup();
95-
reject(new Error(options?.signal?.reason ?? 'waitFor aborted'));
95+
reject(options?.signal?.reason ?? new Error('waitFor aborted'));
9696
};
9797

9898
if (options?.signal?.aborted) {
99-
reject(new Error(options.signal.reason ?? 'waitFor aborted'));
99+
reject(options.signal.reason ?? new Error('waitFor aborted'));
100100
return;
101101
}
102102

packages/livekit-rtc/src/room.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
294294
// Abort all pending FfiClient.waitFor() listeners so they don't leak.
295295
// This causes any in-flight operations (publishData, publishTrack, etc.)
296296
// to reject and clean up their event listeners.
297-
this.disconnectController.abort('Room disconnected');
297+
this.disconnectController.abort();
298298

299299
FfiClient.instance.removeListener(FfiClientEvent.FfiEvent, this.onFfiEvent);
300300
this.removeAllListeners();
@@ -614,7 +614,7 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
614614
} else if (ev.case == 'disconnected') {
615615
// Abort pending waitFor() listeners on server-initiated disconnect too,
616616
// not just on explicit disconnect() calls.
617-
this.disconnectController.abort('Room disconnected');
617+
this.disconnectController.abort();
618618
this.emit(RoomEvent.Disconnected, ev.value.reason!);
619619
} else if (ev.case == 'reconnecting') {
620620
this.emit(RoomEvent.Reconnecting);

0 commit comments

Comments
 (0)