Skip to content

Commit

Permalink
fixup! fix(transport): transferOut timeout must be inside try block
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Feb 10, 2025
1 parent be8e3fb commit 5b7e26b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/transport/src/api/usb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,12 @@ export class UsbApi extends AbstractApi {
const newArray = new Uint8Array(this.chunkSize);
newArray.set(new Uint8Array(buffer));

let timeout;
try {
timeout = setTimeout(() => {
this.logger?.debug('usb: device.transfer out take suspiciously long. timing out.');
device?.reset();
}, 1000);
const timeout = setTimeout(() => {
this.logger?.debug('usb: device.transfer out take suspiciously long. timing out.');
device?.reset().catch(() => {});
}, 1000);

try {
// https://wicg.github.io/webusb/#ref-for-dom-usbdevice-transferout
this.logger?.debug('usb: device.transferOut');

Expand Down

0 comments on commit 5b7e26b

Please sign in to comment.