diff --git a/lib/plugins/browsertime/index.js b/lib/plugins/browsertime/index.js index 9560dd39d..0a73ae4ff 100644 --- a/lib/plugins/browsertime/index.js +++ b/lib/plugins/browsertime/index.js @@ -267,7 +267,20 @@ export default class BrowsertimePlugin extends SitespeedioPlugin { url ); } - run.har = pickAPage(result.har, harIndex); + try { + run.har = pickAPage(result.har, harIndex); + } catch (harError) { + log.error('Couldnt get the right page for the HAR', harError); + super.sendMessage( + 'error', + 'Could not get the right page for the HAR, the page is missing', + { + url, + runIndex, + iteration: runIndex + 1 + } + ); + } } else { // If we do not have a HAR, use browser info from the result if (result.length > 0) {