Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error("Error reading device configuration file: " + err.code);
}
}
if (("options" in data) & ("logLevel" in data["options"]))
{
var validLevels = ["error", "warning", "info", "debug"];
if (!(validLevels.includes(data["options"]["logLevel"])))
{
throw new Error("Optional setting options.logLevel (Currently: " + data["options"]["logLevel"] + ") must be one of error, warning, info, debug")
}
}
else
{
data["options"]["logLevel"] = log.GetLogger(data["options"]["logLevel"].toUpperCase());
}
return new ApplicationConfig(data['identity'],data['auth'],data['options'])
}
}
throw new Error("Error reading device configuration file: " + err.code);
}
}
if (("options" in data) & ("logLevel" in data["options"]))
{
var validLevels = ["error", "warning", "info", "debug"];
if (!(validLevels.includes(data["options"]["logLevel"])))
{
throw new Error("Optional setting options.logLevel (Currently: " + data["options"]["logLevel"] + ") must be one of error, warning, info, debug")
}
}
else
{
data["options"]["logLevel"] = log.GetLogger(data["options"]["logLevel"].toUpperCase());
}
return new DeviceConfig(data['identity'],data['auth'],data['options'])
}
}