@@ -526,21 +526,14 @@ class MicrobitWebUSBConnectionImpl
526526 // Based on: https://github.com/microsoft/pxt/blob/ab97a2422879824c730f009b15d4bf446b0e8547/pxtlib/webusb.ts#L530
527527 private async getFilteredAllowedDevices ( ) : Promise < USBDevice [ ] > {
528528 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 ) {
542531 return [ ] ;
543532 }
533+ const filteredDevices = devices . filter ( ( device ) =>
534+ applyDeviceFilters ( device , defaultFilters , this . exclusionFilters ?? [ ] ) ,
535+ ) ;
536+ return filteredDevices ;
544537 }
545538
546539 private async attemptDeviceConnection (
@@ -550,14 +543,9 @@ class MicrobitWebUSBConnectionImpl
550543 `Attempting connection to: ${ device . manufacturerName } ${ device . productName } ` ,
551544 ) ;
552545 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 ;
561549 }
562550
563551 private async chooseDevice ( ) : Promise < USBDevice > {
0 commit comments