mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
Make offline device error handling more robust.
Change-type: patch Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
parent
5b5f258685
commit
4656f8f11d
@ -65,7 +65,8 @@ export default class DeviceIdentifyCmd extends Command {
|
||||
try {
|
||||
await balena.models.device.identify(params.uuid);
|
||||
} catch (e) {
|
||||
if (e.message === 'Request error: No online device(s) found') {
|
||||
// Expected message: 'Request error: No online device(s) found'
|
||||
if (e.message?.toLowerCase().includes('online')) {
|
||||
throw new ExpectedError(`Device ${params.uuid} is not online`);
|
||||
} else {
|
||||
throw e;
|
||||
|
@ -69,7 +69,8 @@ export default class DeviceShutdownCmd extends Command {
|
||||
try {
|
||||
await balena.models.device.shutdown(params.uuid, options);
|
||||
} catch (e) {
|
||||
if (e.message === 'Request error: No online device(s) found') {
|
||||
// Expected message: 'Request error: No online device(s) found'
|
||||
if (e.message?.toLowerCase().includes('online')) {
|
||||
throw new ExpectedError(`Device ${params.uuid} is not online`);
|
||||
} else {
|
||||
throw e;
|
||||
|
Loading…
Reference in New Issue
Block a user