From 75a1214269884b607de6b235d696f71cbc679ef7 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Fri, 13 Oct 2023 15:59:38 +0200 Subject: [PATCH] Part 1 of a better error message when measure without navigating (#3980) --- lib/plugins/browsertime/index.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/plugins/browsertime/index.js b/lib/plugins/browsertime/index.js index d80fa10696..b761af7bc3 100644 --- a/lib/plugins/browsertime/index.js +++ b/lib/plugins/browsertime/index.js @@ -281,16 +281,30 @@ export default class BrowsertimePlugin extends SitespeedioPlugin { 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', - { + if (message.type === 'browsertime.navigationScripts') { + const message = + 'There are pages that misses data. This is in almost all cases caused by that you try to measure a page view but you do not navigate to a new page.'; + log.error(message, harError); + super.sendMessage('error', message, { url, runIndex, iteration: runIndex + 1 - } - ); + }); + } else { + 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