From 7427a9cb9bd406877f24a1c95c366c9728298f64 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 17 May 2021 00:31:10 +0200 Subject: [PATCH] Robuster handling of allKnownLayers --- Customizations/AllKnownLayers.ts | 18 +++++++++++------- Customizations/JSON/SourceConfig.ts | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Customizations/AllKnownLayers.ts b/Customizations/AllKnownLayers.ts index 2c97f7513..87fe98b17 100644 --- a/Customizations/AllKnownLayers.ts +++ b/Customizations/AllKnownLayers.ts @@ -22,18 +22,22 @@ 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; } - const parsed = new LayerConfig(layer, "shared_layer_in_theme") - sharedLayers.set(layer.id, parsed); - sharedLayers[layer.id] = parsed; + 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) + } } } - + return sharedLayers; } diff --git a/Customizations/JSON/SourceConfig.ts b/Customizations/JSON/SourceConfig.ts index e033d92c2..2ed8fc40d 100644 --- a/Customizations/JSON/SourceConfig.ts +++ b/Customizations/JSON/SourceConfig.ts @@ -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)