@@ -526,21 +526,14 @@ class MicrobitWebUSBConnectionImpl
526
526
// Based on: https://github.com/microsoft/pxt/blob/ab97a2422879824c730f009b15d4bf446b0e8547/pxtlib/webusb.ts#L530
527
527
private async getFilteredAllowedDevices ( ) : Promise < USBDevice [ ] > {
528
528
this . log ( "Retrieving previously paired USB devices" ) ;
529
- try {
530
- const devices = await this . withEnrichedErrors ( ( ) =>
531
- navigator . usb ?. getDevices ( ) ,
532
- ) ;
533
- if ( devices === undefined ) {
534
- return [ ] ;
535
- }
536
- const filteredDevices = devices . filter ( ( device ) =>
537
- applyDeviceFilters ( device , defaultFilters , this . exclusionFilters ?? [ ] ) ,
538
- ) ;
539
- return filteredDevices ;
540
- } catch ( error : any ) {
541
- this . log ( `Failed to retrieve paired devices: ${ error . message } ` ) ;
529
+ const devices = await navigator . usb ?. getDevices ( ) ;
530
+ if ( devices === undefined ) {
542
531
return [ ] ;
543
532
}
533
+ const filteredDevices = devices . filter ( ( device ) =>
534
+ applyDeviceFilters ( device , defaultFilters , this . exclusionFilters ?? [ ] ) ,
535
+ ) ;
536
+ return filteredDevices ;
544
537
}
545
538
546
539
private async attemptDeviceConnection (
@@ -550,14 +543,9 @@ class MicrobitWebUSBConnectionImpl
550
543
`Attempting connection to: ${ device . manufacturerName } ${ device . productName } ` ,
551
544
) ;
552
545
this . log ( `Serial number: ${ device . serialNumber } ` ) ;
553
- try {
554
- const connection = new DAPWrapper ( device , this . logging ) ;
555
- await withTimeout ( connection . reconnectAsync ( ) , 10_000 ) ;
556
- return connection ;
557
- } catch ( error : any ) {
558
- this . log ( `Connection attempt failed: ${ error . message } ` ) ;
559
- return ;
560
- }
546
+ const connection = new DAPWrapper ( device , this . logging ) ;
547
+ await withTimeout ( connection . reconnectAsync ( ) , 10_000 ) ;
548
+ return connection ;
561
549
}
562
550
563
551
private async chooseDevice ( ) : Promise < USBDevice > {
0 commit comments