Skip to content

Commit f8d5e0c

Browse files
committed
fix: handle USB device configuration selection error
1 parent 2819a97 commit f8d5e0c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/usb/sagas.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@ function* handleUsbConnectPybricks(hotPlugDevice?: USBDevice): Generator {
178178
);
179179

180180
// TODO: show error message to user here
181-
console.error('Failed to select USB device configuration:', selectErr);
182-
yield* put(usbDidFailToConnectPybricks());
183-
yield* cleanup();
184-
return;
181+
if (selectErr) {
182+
console.error('Failed to select USB device configuration:', selectErr);
183+
yield* put(usbDidFailToConnectPybricks());
184+
yield* cleanup();
185+
return;
186+
}
185187
}
186188

187189
assert(

0 commit comments

Comments
 (0)