Skip to content

Commit

Permalink
fixup! fix(connect): ignore disposed error in devicelist
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrjpolak committed Dec 3, 2024
1 parent 6877cc0 commit bde5bd8
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions packages/connect/src/device/DeviceList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,7 @@ export class DeviceList extends TypedEmitter<DeviceListEvents> implements IDevic

return promise
.then(this.createInitPromise.bind(this))
.catch(error => {
if (error.message === 'Disposed') {
return;
}
throw error;
})
.catch(() => {})
.finally(() => {
this.rejectPending = undefined;
});
Expand Down Expand Up @@ -359,19 +354,12 @@ export class DeviceList extends TypedEmitter<DeviceListEvents> implements IDevic
this.on(DEVICE.CONNECT, onDeviceConnect);
this.on(DEVICE.CONNECT_UNACQUIRED, onDeviceConnect);

return promise
.catch(error => {
if (error.message === 'Disposed') {
return;
}
throw error;
})
.finally(() => {
this.rejectPending = undefined;
clearTimeout(autoResolveTransportEventTimeout);
this.off(DEVICE.CONNECT, onDeviceConnect);
this.off(DEVICE.CONNECT_UNACQUIRED, onDeviceConnect);
});
return promise.finally(() => {
this.rejectPending = undefined;
clearTimeout(autoResolveTransportEventTimeout);
this.off(DEVICE.CONNECT, onDeviceConnect);
this.off(DEVICE.CONNECT_UNACQUIRED, onDeviceConnect);
});
}

getDeviceCount() {
Expand Down

0 comments on commit bde5bd8

Please sign in to comment.