Skip to content

Commit

Permalink
🐝 (baking) report explorers with missing variable IDs (#3552)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann authored May 6, 2024
1 parent 2e803e6 commit 7d5fb2c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions baker/siteRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,18 @@ export const renderExplorerPage = async (
`SELECT id, grapherConfigETL, grapherConfigAdmin FROM variables WHERE id IN (?)`,
[requiredVariableIds]
)

// check if all required variable IDs exist in the database
const missingIds = requiredVariableIds.filter(
(id) => !partialGrapherConfigRows.find((row) => row.id === id)
)
if (missingIds.length > 0) {
void logErrorAndMaybeSendToBugsnag(
new JsonError(
`Referenced variable IDs do not exist in the database for explorer ${program.slug}: ${missingIds.join(", ")}.`
)
)
}
}

const parseGrapherConfigFromRow = (row: ChartRow): GrapherInterface => {
Expand Down

0 comments on commit 7d5fb2c

Please sign in to comment.