Interactive interface for browsing global, full-resolution satellite imagery
log error when measurement names dont match
Jason Kentaa2e1954cdef
diff --git a/web/js/components/layer/product-picker/browse/category-cell.js b/web/js/components/layer/product-picker/browse/category-cell.jsindex aa3861866..6504815cb 100644--- a/web/js/components/layer/product-picker/browse/category-cell.js+++ b/web/js/components/layer/product-picker/browse/category-cell.js@@ -17,6 +17,13 @@ const CategoryCell = (props) => {}: {};+ const checkForSources = (measurement) => {+ if (measurementConfig[measurement]) {+ return hasMeasurementSource(measurementConfig[measurement]);+ }+ throw new Error(`No measurement config entry for "${measurement}".`);+ };+return (<divkey={category.id}@@ -36,7 +43,7 @@ const CategoryCell = (props) => {</h3><ul>{category.measurements- .filter((measurement) => hasMeasurementSource(measurementConfig[measurement]))+ .filter(checkForSources).slice(0, 7).map((measurement, index) => {const current = measurementConfig[measurement];diff --git a/web/js/modules/product-picker/format-config.js b/web/js/modules/product-picker/format-config.jsindex 79d62e12a..add0366c0 100644--- a/web/js/modules/product-picker/format-config.js+++ b/web/js/modules/product-picker/format-config.js@@ -1,6 +1,7 @@import {forEach as lodashForEach,map as lodashMap,+ get as lodashGet,} from 'lodash';import moment from 'moment';import { available } from '../layers/selectors';@@ -51,7 +52,10 @@ function setCategoryFacetProps (layers, measurements, categories) {return;}(subCategoryObj.measurements || []).forEach((measureKey) => {- const { sources } = measurements[measureKey];+ const sources = lodashGet(measurements, `[${measureKey}].sources`);+ if (!sources) {+ throw new Error(`No measurement config entry for "${measureKey}".`);+ }lodashForEach(sources, ({ settings = [] }) => {settings.forEach((id) => {setLayerProp(layers[id], 'categories', subCategoryKey);