Robuster handling of allKnownLayers

This commit is contained in:
Pieter Vander Vennet 2021-05-17 00:31:10 +02:00
parent e555a19d30
commit 7427a9cb9b
2 changed files with 12 additions and 8 deletions

View file

@ -28,9 +28,13 @@ export default class AllKnownLayers {
if (typeof layer === "string") { if (typeof layer === "string") {
continue; continue;
} }
try {
const parsed = new LayerConfig(layer, "shared_layer_in_theme") const parsed = new LayerConfig(layer, "shared_layer_in_theme")
sharedLayers.set(layer.id, parsed); sharedLayers.set(layer.id, parsed);
sharedLayers[layer.id] = parsed; sharedLayers[layer.id] = parsed;
} catch (e) {
console.error("Could not parse a layer in theme ", layout.id, "due to", e)
}
} }
} }

View file

@ -27,7 +27,7 @@ export default class SourceConfig {
defined++; defined++;
} }
if (defined == 0) { if (defined == 0) {
throw "Source: nothing correct defined in the source" throw `Source: nothing correct defined in the source (in ${context}) (the params are ${JSON.stringify(params)})`
} }
if(params.isOsmCache && params.geojsonSource == undefined){ if(params.isOsmCache && params.geojsonSource == undefined){
console.error(params) console.error(params)