chrome-launcher icon indicating copy to clipboard operation
chrome-launcher copied to clipboard

chrome-launcher doesn`t propogate errors if some flag is a empty string

Open nikhil-bhat opened this issue 7 years ago • 0 comments

if some flag is set to a empty string chrome launcher doesnt add the error in staring chrome in the stack strace . Have included the sample code here since we are not setting proxy variable in our config an empty flag is being passed to chrome launcher . chrome fails to launch but this doesnt show up in the log .any work around for it so it shows up in error

try {
      chromeInstance = await chromeLauncher.launch({
        port: 9222,
        chromeFlags: [
          '--disable-gpu',
          '--hide-scrollbars',
          headless ? '--headless' : '',
          config.proxy ? `--proxy-server=${config.proxy}` : '',
        ],
        handleSIGINT: true,
      });
      logger.debug({
        [logger.fields.description]: 'CHROME_LAUNCHED',
        [logger.fields.object]: JSON.stringify(chromeInstance),
      });
      lock.releaseLock();
    } catch (error) {
      lock.releaseLock();
      logger.warn({
        [logger.fields.description]: 'ERROR_LAUNCHING_CHROME',
        [logger.fields.stack_trace]: error.stack,
      });
      throw error;
    }
  }

nikhil-bhat avatar Dec 14 '17 16:12 nikhil-bhat