mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-31 00:24:15 +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 {
|
try {
|
||||||
await balena.models.device.identify(params.uuid);
|
await balena.models.device.identify(params.uuid);
|
||||||
} catch (e) {
|
} 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`);
|
throw new ExpectedError(`Device ${params.uuid} is not online`);
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -69,7 +69,8 @@ export default class DeviceShutdownCmd extends Command {
|
|||||||
try {
|
try {
|
||||||
await balena.models.device.shutdown(params.uuid, options);
|
await balena.models.device.shutdown(params.uuid, options);
|
||||||
} catch (e) {
|
} 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`);
|
throw new ExpectedError(`Device ${params.uuid} is not online`);
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user