Robuster handling, add helpful error messages for wrong themes

This commit is contained in:
pietervdvn 2021-05-17 17:10:54 +02:00
parent 554fefd708
commit 8ca5a99797
2 changed files with 13 additions and 0 deletions

View file

@ -28,6 +28,10 @@ export default class AllKnownLayers {
if (typeof layer === "string") {
continue;
}
if(layer.builtin !== undefined){
// This is a builtin layer of which stuff is overridden - skip
continue;
}
try {
const parsed = new LayerConfig(layer, "shared_layer_in_theme")
sharedLayers.set(layer.id, parsed);

View file

@ -104,6 +104,15 @@ export default class TagRenderingConfig {
if (mapping.ifnot !== undefined && !this.multiAnswer) {
throw `${context}.mapping[${i}]: Invalid mapping: ifnot defined, but the tagrendering is not a multianswer`
}
if(mapping.if === undefined){
throw `${context}.mapping[${i}]: Invalid mapping: "if" is not defined, but the tagrendering is not a multianswer`
}
if(typeof mapping.if !== "string" && mapping.if["length"] !== undefined){
throw `${context}.mapping[${i}]: Invalid mapping: "if" is defined as an array. Use {"and": <your conditions>} or {"or": <your conditions>} instead`
}
let hideInAnswer: boolean | TagsFilter = false;
if (typeof mapping.hideInAnswer === "boolean") {
hideInAnswer = mapping.hideInAnswer;