Skip to content

Commit

Permalink
fix(core): handle exceptions whenn computing median run
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 20, 2022
1 parent d62a7b6 commit 807feba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/puppeteer/tasks/lighthouse.ts
Expand Up @@ -111,7 +111,14 @@ export const runLighthouseTask: PuppeteerTask = async(props) => {
}
}

const report = samples.length <= 1 ? samples[0] : computeMedianRun(samples)
let report = samples[0]
if (samples.length > 1) {
try {
report = computeMedianRun(samples)
} catch(e) {
logger.warn('Error when computing median score, possibly audit failed.', e)
}
}

if (!report) {
logger.error(`Task \`runLighthouseTask\` has failed to run for path "${routeReport.route.path}".`)
Expand Down

0 comments on commit 807feba

Please sign in to comment.