lua: read_options: quote values at error messages

This makes it easier to understand the error in cases of incorrect
syntax or formatting at .conf files. (js already has this quoting).

Fixes #9105
This commit is contained in:
Avi Halachmi (:avih) 2021-08-10 11:00:18 +03:00
parent e9e1c41060
commit 8a597a484b
1 changed files with 3 additions and 3 deletions

View File

@ -15,14 +15,14 @@ local function typeconv(desttypeval, val)
elseif val == "no" then
val = false
else
msg.error("Error: Can't convert " .. val .. " to boolean!")
msg.error("Error: Can't convert '" .. val .. "' to boolean!")
val = nil
end
elseif type(desttypeval) == "number" then
if not (tonumber(val) == nil) then
val = tonumber(val)
else
msg.error("Error: Can't convert " .. val .. " to number!")
msg.error("Error: Can't convert '" .. val .. "' to number!")
val = nil
end
end
@ -92,7 +92,7 @@ local function read_options(options, identifier, on_update)
-- match found values with defaults
if option_types[key] == nil then
msg.warn(conffilename..":"..linecounter..
" unknown key " .. key .. ", ignoring")
" unknown key '" .. key .. "', ignoring")
else
local convval = typeconv(option_types[key], val)
if convval == nil then