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
This commit is contained in:
John Knox
2019-05-28 04:17:24 -07:00
committed by Facebook Github Bot
parent 1d6399c1b5
commit 79a4c3a163

View File

@@ -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,