check_site: improve error message for unset values

This commit is contained in:
Matthias Schiffer 2018-04-27 17:13:42 +02:00
parent 3519f4e61b
commit aeae9df001
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -108,7 +108,12 @@ local function var_error(path, val, msg)
src = site_src()
end
config_error(src, 'expected %s to %s, but it is %s (a %s value)', path_to_string(path), msg, tostring(val), type(val))
local found = 'unset'
if val ~= nil then
found = string.format('%s (a %s value)', tostring(val), type(val))
end
config_error(src, 'expected %s to %s, but it is %s', path_to_string(path), msg, found)
end