Skip to content

Commit

Permalink
Error handling when flashing devices in Protected Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed Jun 28, 2024
1 parent b21b0dc commit 0aec098
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cmd/usb-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ async function reopenInDfuMode(device) {
}
return device;
} catch (error) {
// ignore error
// ignore other errors
if (error instanceof DeviceProtectionError) {
throw new Error('Operation cannot be completed due to Device Protection.');
}
}
}
throw new Error('Unable to reconnect to the device. Try again or run particle update to repair the device');
Expand Down Expand Up @@ -313,7 +316,9 @@ async function reopenInNormalMode(device, { reset } = {}) {
}
}
} catch (err) {
// ignore error
// ignore other errors
if (err instanceof DeviceProtectionError) {
throw new Error('Operation cannot be completed due to Device Protection.');
}
}
throw new Error('Unable to reconnect to the device. Try again or run particle update to repair the device');
Expand Down

0 comments on commit 0aec098

Please sign in to comment.