From 79a4c3a16396bf0b4ea1c946ad97d97ab0b15092 Mon Sep 17 00:00:00 2001 From: John Knox Date: Tue, 28 May 2019 04:17:24 -0700 Subject: [PATCH] Explicit no devices found error Summary: Distinguish between the cases when there's something wrong with listing devices and we don't see any, and when we do see some but none of them match what we're expecting. Reviewed By: passy Differential Revision: D15394042 fbshipit-source-id: 02728671d46531aec37da4bcafb85393269bf9cb --- src/utils/CertificateProvider.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/CertificateProvider.js b/src/utils/CertificateProvider.js index ee2f4fcd6..e70c1b576 100644 --- a/src/utils/CertificateProvider.js +++ b/src/utils/CertificateProvider.js @@ -255,6 +255,9 @@ export default class CertificateProvider { return this.adb .then(client => client.listDevices()) .then((devices: Array<{id: string}>) => { + if (devices.length === 0) { + throw new Error('No Android devices found'); + } const deviceMatchList = devices.map(device => this.androidDeviceHasMatchingCSR( deviceCsrFilePath, @@ -304,6 +307,9 @@ export default class CertificateProvider { return Promise.resolve(matches[1]); } return iosUtil.targets().then(targets => { + if (targets.length === 0) { + throw new Error('No iOS devices found'); + } const deviceMatchList = targets.map(target => this.iOSDeviceHasMatchingCSR( deviceCsrFilePath,