Skip to content

Commit

Permalink
fix(ios): improve getSimulators error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
tlancina committed Jun 5, 2019
1 parent 605164a commit 86205d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ios/utils/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ interface SimCtlOutput {

export async function getSimulators() {
const simctl = spawnSync('xcrun', ['simctl', 'list', '--json'], { encoding: 'utf8' });
if (simctl.status) {
throw new Exception(`Unable to retrieve simulator list: ${simctl.stderr}`);
}

const [xcodeVersion] = getXcodeVersionInfo();
if (Number(xcodeVersion) < 10) {
throw new Exception('native-run only supports Xcode 10 and later');
Expand All @@ -56,7 +60,7 @@ export async function getSimulators() {
.reduce((prev, next) => prev.concat(next)) // flatten
.sort((a, b) => a.name < b.name ? -1 : 1);
} catch (err) {
throw new Exception('Unable to retrieve simulator list');
throw new Exception(`Unable to retrieve simulator list: ${err.message}`);
}
}

Expand Down

0 comments on commit 86205d6

Please sign in to comment.