Apply 1 suggestion(s) to 1 file(s)

This commit is contained in:
Laurent Mazet 2020-09-13 10:00:32 +00:00
parent 677724b76c
commit 94a76b3f5c
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,9 @@
function setConf(parameterName, defaultValue) {
if (typeof Conf[parameterName] === "undefined") {
Conf[parameterName] = defaultValue;
} else if (typeof Conf[parameterName] !== typeof defaultValue) {
alert("Head's up - configuration " + parameterName + " does not have the right type. It should be a " + (typeof defaultValue) + ", it is a " + (typeof Conf[parameterName]));
throw new Error("Wrong type for configuration " + parameterName + ", expected " + (typeof defaultValue) + ", got " + (typeof Conf[parameterName]));
}
}