Comparison

core/moduleapi.lua @ 13207:c563da1694bf

core.moduleapi: Log error for unexpected types (booleans?) set as periods
author Kim Alvefur <zash@zash.se>
date Sun, 16 Jul 2023 21:02:24 +0200
parent 13206:7435a9341bb3
child 13208:a7c6ea1c5308
comparison
equal deleted inserted replaced
13206:7435a9341bb3 13207:c563da1694bf
270 local ret = human_io.parse_duration(value); 270 local ret = human_io.parse_duration(value);
271 if value ~= nil and ret == nil then 271 if value ~= nil and ret == nil then
272 self:log("error", "Config option '%s' not understood, expecting a period (e.g. \"2 days\")", name); 272 self:log("error", "Config option '%s' not understood, expecting a period (e.g. \"2 days\")", name);
273 end 273 end
274 return ret; 274 return ret;
275 elseif value ~= nil then
276 self:log("error", "Config option '%s' expects a number or a period description string (e.g. \"3 hours\"), not %s", name, type(value));
275 end 277 end
276 end 278 end
277 279
278 function api:get_option_boolean(name, ...) 280 function api:get_option_boolean(name, ...)
279 local value = self:get_option_scalar(name, ...); 281 local value = self:get_option_scalar(name, ...);