Skip to content

Commit

Permalink
throw when metric metadata is missing for a temporary metric, since l…
Browse files Browse the repository at this point in the history
…ooker studio will error later on anyway
  • Loading branch information
diosmosis committed Jul 30, 2024
1 parent b0b8f8b commit ee48d16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/schema/report-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ export function getFieldsFromReportMetadata(
const matomoType = reportMetadata.temporaryMetricSemanticTypes?.[metricId];

if (!matomoType) {
return;
// this error will cause a fatal in Looker Studio when getting data, so we fail early
// here
throw new Error(`Matomo Error: Missing temporary metric metadata for '${metricId}' in ${reportMetadata.module}.${reportMetadata.action} report metadata.`);
}

addTemporaryMetric(fields, metricId, matomoType, siteCurrency, aggregationType);
Expand Down

0 comments on commit ee48d16

Please sign in to comment.