Skip to content

Commit

Permalink
fix(browser): added error handling for chrome-launcher
Browse files Browse the repository at this point in the history
Added error handling for chrome-launcher

fix #50
  • Loading branch information
onderceylan committed Oct 25, 2019
1 parent 05edb2e commit c6ed23a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/helpers/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,16 @@ const getSystemBrowserInstance = async (
const getBrowserInstance = async (
launchArgs?: LaunchOptions,
): Promise<Browser> => {
const chrome = await launchSystemBrowser();
if (chrome && chrome.port > 0) {
return getSystemBrowserInstance(chrome, launchArgs);
let browser: Browser;

try {
const chrome = await launchSystemBrowser();
browser = await getSystemBrowserInstance(chrome, launchArgs);
} catch (e) {
browser = await getLocalBrowserInstance(launchArgs);
}

return getLocalBrowserInstance(launchArgs);
return browser;
};

export default {
Expand Down

0 comments on commit c6ed23a

Please sign in to comment.