Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
propogate timeout error to user
Browse files Browse the repository at this point in the history
Summary:
First time launching an iOS simulator will timeout as it can take up to 2 minutes

* propagate the error from the server back to client
* display a specific error when an idb was killed due to a timeout (30 seconds by default)

Reviewed By: lblasa

Differential Revision: D57908262

fbshipit-source-id: a95bf0fb7ed334217575de4a9aaf0ef64658d968
  • Loading branch information
antonk52 authored and facebook-github-bot committed May 29, 2024
1 parent 91f0cbb commit 73a0175
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
7 changes: 6 additions & 1 deletion desktop/flipper-server/src/devices/ios/iOSDeviceManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ export class IOSDeviceManager {
const bridge = await this.getBridge();
await bridge.launchSimulator(udid);
} catch (e) {
console.warn('Failed to launch simulator:', e);
if (e.killed === true && e.signal === 'SIGTERM') {
throw new Error('Failed to launch simulator: command timeout');
} else {
console.warn('Failed to launch simulator:', e);
throw e;
}
}
}

Expand Down
20 changes: 18 additions & 2 deletions desktop/flipper-ui/src/sandy-chrome/appinspect/LaunchEmulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,24 @@ export const LaunchEmulatorDialog = withTrackingScope(
);
onClose();
} catch (e) {
console.warn('Failed to start simulator: ', e);
message.error(`Failed to start simulator: ${e}`);
if (
// definitely a server error
typeof e === 'string' &&
e.includes('command timeout')
) {
message.warn(
'Launching simulator may take up to 2 minutes for the first time. Please wait.',
// seconds
20,
);
} else {
console.warn('Failed to start simulator: ', e);
message.error(
`Failed to start simulator: ${e}`,
// seconds
20,
);
}
} finally {
setPendingEmulators(
produce((draft) => {
Expand Down

0 comments on commit 73a0175

Please sign in to comment.