Skip to content

Commit 86205d6

Browse files
committed
fix(ios): improve getSimulators error messaging
1 parent 605164a commit 86205d6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ios/utils/simulator.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ interface SimCtlOutput {
4040

4141
export async function getSimulators() {
4242
const simctl = spawnSync('xcrun', ['simctl', 'list', '--json'], { encoding: 'utf8' });
43+
if (simctl.status) {
44+
throw new Exception(`Unable to retrieve simulator list: ${simctl.stderr}`);
45+
}
46+
4347
const [xcodeVersion] = getXcodeVersionInfo();
4448
if (Number(xcodeVersion) < 10) {
4549
throw new Exception('native-run only supports Xcode 10 and later');
@@ -56,7 +60,7 @@ export async function getSimulators() {
5660
.reduce((prev, next) => prev.concat(next)) // flatten
5761
.sort((a, b) => a.name < b.name ? -1 : 1);
5862
} catch (err) {
59-
throw new Exception('Unable to retrieve simulator list');
63+
throw new Exception(`Unable to retrieve simulator list: ${err.message}`);
6064
}
6165
}
6266

0 commit comments

Comments
 (0)