From ecb940ee1772462620a0ae3c72235e7f256836b6 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Mon, 15 Dec 2025 14:10:43 +0100 Subject: [PATCH] Safer handling of broken URLs --- lib/plugins/browsertime/index.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/plugins/browsertime/index.js b/lib/plugins/browsertime/index.js index 71cc92e67..ef98a2cb0 100644 --- a/lib/plugins/browsertime/index.js +++ b/lib/plugins/browsertime/index.js @@ -95,7 +95,7 @@ export default class BrowsertimePlugin extends SitespeedioPlugin { async processMessage(message) { const options = this.options; switch (message.type) { - // When sistespeed.io starts, a setup messages is posted on the queue + // When sitespeed.io starts, a setup messages is posted on the queue // and all plugins can tell other plugins that they are alive and are ready // to receive configuration case 'sitespeedio.setup': { @@ -105,12 +105,18 @@ export default class BrowsertimePlugin extends SitespeedioPlugin { if (this.options.urlMetaData) { for (let url of Object.keys(this.options.urlMetaData)) { const alias = this.options.urlMetaData[url]; - const group = new URL(url).hostname; - this.allAlias[alias] = url; - super.sendMessage('browsertime.alias', alias, { - url, - group - }); + try { + const group = new URL(url).hostname; + this.allAlias[alias] = url; + super.sendMessage('browsertime.alias', alias, { + url, + group + }); + } catch (error) { + log.error( + 'Could not get group for URL:' + url + ' with error' + error + ); + } } }