From e4398c2e106d607aec9b047c81047e2e8543f974 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Fri, 13 Oct 2023 15:46:05 +0200 Subject: [PATCH] Part 1 of a better error message when measure without navigating --- 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