Better error message for wrong configured metrics https://github.com/sitespeedio/sitespeed.io/issues/3256

This commit is contained in:
soulgalore 2021-01-16 22:21:42 +01:00
parent 0fc532664d
commit f972877174
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,11 @@ module.exports = {
for (let metricType of Object.keys(budgetForThisURL)) {
for (let metric of Object.keys(budgetForThisURL[metricType])) {
if (friendlyNames[tool][metricType]) {
if (!friendlyNames[tool][metricType][metric]) {
log.error(
`It seems like you configure a metric ${metric} that we do not have a friendly name. Please check the docs if it is right.`
);
}
const fullPath = friendlyNames[tool][metricType][metric].path;
let value = get(message.data, fullPath);
if (value && message.type === 'lighthouse.pageSummary') {