particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

Add Error Handling for Device Mode Checks #715

Closed keeramis closed 10 months ago

keeramis commented 10 months ago

Description

This was the issue:

particle.js usb list
DeviceProtectionError
    at errorForRequest (/home/monkbroc/Programming/cli/node_modules/particle-usb/src/result.js:144:10)
    at /home/monkbroc/Programming/cli/node_modules/particle-usb/src/device.js:917:11
    at async klass.getDeviceMode (/home/monkbroc/Programming/cli/node_modules/particle-usb/src/device.js:352:13)
    at async Promise.all (index 2)
    at async /home/monkbroc/Programming/cli/src/lib/utilities.js:153:18
    at async CLI.runCommand (/home/monkbroc/Programming/cli/src/app/cli.js:148:4)
    at async CLI.run (/home/monkbroc/Programming/cli/src/app/cli.js:175:11) {
  result: 'Device is protected'
}

Propagate device protection error gracefully from the particle-usb

How to Test

Run npm start -- usb list on a bunch of devices with at least one protected device among them Run npm start -- flash --local tinker

Related Issues / Discussions

N/A

Completeness