Skip to content

Commit

Permalink
tolerate partial string desc fetches
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Feb 13, 2024
1 parent e9ba14b commit 4b5a685
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app-shell/src/system-info/usb-devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ const orDefault = <T, U>(
promise: Promise<T>,
defaulter: (err: any) => U
): Promise<T | U> =>
promise.then((result: T): T => result).catch((err: any) => defaulter(err))
promise
.then((result: T): T => result)
.catch(
(err: any) =>
new Promise<U>(resolve => {
resolve(defaulter(err))
})
)

function upstreamDeviceFromUsbDevice(device: usb.Device): Promise<UsbDevice> {
return new Promise<usb.Device>((resolve, reject) => {
Expand Down

0 comments on commit 4b5a685

Please sign in to comment.