Skip to content

Commit

Permalink
Fix misplaced try/catch not catching kill errors (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion authored and vikerman committed Dec 12, 2018
1 parent f0e35a7 commit dcda7b5
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/launcher/launcher.ts
Expand Up @@ -83,18 +83,16 @@ export function SaucelabsLauncher(args,
});

this.on('kill', async (doneFn: () => void) => {
await Promise.all(connectedDrivers.map(driver => {
try {
return driver.quit();
} catch (e) {
// We need to ignore the exception here because we want to make sure that Karma is still
// able to retry connecting if Saucelabs itself terminated the session (and not Karma)
// For example if the "idleTimeout" is exceeded and Saucelabs errored the session. See:
// https://wiki.saucelabs.com/display/DOCS/Test+Didn%27t+See+a+New+Command+for+90+Seconds
log.error('Could not quit the Saucelabs selenium connection. Failure message:');
log.error(e);
}
}));
try {
await Promise.all(connectedDrivers.map(driver => driver.quit()));
} catch (e) {
// We need to ignore the exception here because we want to make sure that Karma is still
// able to retry connecting if Saucelabs itself terminated the session (and not Karma)
// For example if the "idleTimeout" is exceeded and Saucelabs errored the session. See:
// https://wiki.saucelabs.com/display/DOCS/Test+Didn%27t+See+a+New+Command+for+90+Seconds
log.error('Could not quit the Saucelabs selenium connection. Failure message:');
log.error(e);
}

// Reset connected drivers in case the launcher will be reused.
connectedDrivers = [];
Expand Down

0 comments on commit dcda7b5

Please sign in to comment.