Better error handling

This commit is contained in:
Pieter Vander Vennet 2022-04-22 03:17:40 +02:00
parent 700cad1000
commit 979041dacb
6 changed files with 44 additions and 21 deletions

View file

@ -134,6 +134,9 @@ export default class LayerConfig extends WithContextLoader {
this.allowSplit = json.allowSplit ?? false;
this.name = Translations.T(json.name, translationContext + ".name");
if(json.units!==undefined && !Array.isArray(json.units)){
throw "At "+context+".units: the 'units'-section should be a list; you probably have an object there"
}
this.units = (json.units ?? []).map(((unitJson, i) => Unit.fromJson(unitJson, `${context}.unit[${i}]`)))
if (json.description !== undefined) {