Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #348 from meriadec/enhance-deviceaccess-error
Browse files Browse the repository at this point in the history
Additional error handling in `deviceAccess`
  • Loading branch information
gre authored Sep 9, 2019
2 parents 8e8b380 + 23832a7 commit a4a6b53
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/hw/deviceAccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
CantOpenDevice,
UpdateYourApp,
BluetoothRequired,
TransportWebUSBGestureRequired,
TransportInterfaceNotAvailable,
FirmwareOrAppUpdateRequired,
TransportStatusError,
DeviceHalted
Expand Down Expand Up @@ -121,6 +123,8 @@ export const withDevice = (deviceId: string) => <T>(
.catch(e => {
finish();
if (e instanceof BluetoothRequired) throw e;
if (e instanceof TransportWebUSBGestureRequired) throw e;
if (e instanceof TransportInterfaceNotAvailable) throw e;
throw new CantOpenDevice(e.message);
})
.then(transport => {
Expand Down Expand Up @@ -158,6 +162,8 @@ export const genericCanRetryOnError = (err: ?Error) => {
if (err instanceof UpdateYourApp) return false;
if (err instanceof FirmwareOrAppUpdateRequired) return false;
if (err instanceof DeviceHalted) return false;
if (err instanceof TransportWebUSBGestureRequired) return false;
if (err instanceof TransportInterfaceNotAvailable) return false;
return true;
};

Expand Down

0 comments on commit a4a6b53

Please sign in to comment.