diff --git a/lib/actions-oclif/device/identify.ts b/lib/actions-oclif/device/identify.ts index ccf9d215..21ff684c 100644 --- a/lib/actions-oclif/device/identify.ts +++ b/lib/actions-oclif/device/identify.ts @@ -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; diff --git a/lib/actions-oclif/device/shutdown.ts b/lib/actions-oclif/device/shutdown.ts index 74438ff0..0f5a6769 100644 --- a/lib/actions-oclif/device/shutdown.ts +++ b/lib/actions-oclif/device/shutdown.ts @@ -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;