Robuster handling of allKnownLayers

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

View file

@ -23,14 +23,18 @@ export default class AllKnownLayers {
}
}
for(const layout of known_layers.themes){
for (const layout of known_layers.themes) {
for (const layer of layout.layers) {
if(typeof layer === "string"){
if (typeof layer === "string") {
continue;
}
try {
const parsed = new LayerConfig(layer, "shared_layer_in_theme")
sharedLayers.set(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++;
}
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){
console.error(params)