Safer handling of broken URLs (#4573)

This commit is contained in:
Peter Hedenskog 2025-12-15 15:06:07 +01:00 committed by GitHub
parent 9d8b03de0c
commit 584648356d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 7 deletions

View File

@ -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
);
}
}
}