Modul:Protection banner: Unterschied zwischen den Versionen
make the category name function errors more descriptive
(fix category name function comments) |
(make the category name function errors more descriptive) |
||
Zeile 226: | Zeile 226: | ||
local propertiesKey = categoryOrder[i] | local propertiesKey = categoryOrder[i] | ||
if not propertiesKey then | if not propertiesKey then | ||
local msg = 'no entry found for key ' | |||
.. i | |||
.. ' in the cfg.reasons.' | |||
.. reason | |||
.. '.categoryOrder table' | |||
error(msg) | |||
end | end | ||
local property = properties[propertiesKey] | local property = properties[propertiesKey] | ||
if not property then | if not property then | ||
local msg = 'invalid value "' | |||
.. propertiesKey | |||
.. '" detected in the cfg.reasons.' | |||
.. reason | |||
.. '.categoryOrder table' | |||
error(msg) | |||
end | end | ||
if dupes[ | if dupes[propertiesKey] then | ||
local msg = 'duplicate values "' | |||
.. propertiesKey | |||
.. '" detected in the cfg.reasons.' | |||
.. reason | |||
.. '.categoryOrder table' | |||
error(msg) | |||
else | else | ||
dupes[ | dupes[propertiesKey] = true | ||
end | end | ||
configOrder[i] = property | configOrder[i] = property | ||
Zeile 246: | Zeile 261: | ||
local property = properties[categoryOrder] | local property = properties[categoryOrder] | ||
if not property then | if not property then | ||
error( | local msg = '"' | ||
.. categoryOrder | |||
.. '" is not a valid value of cfg.reasons.' | |||
.. reason | |||
.. '.categoryOrder' | |||
error(msg) | |||
end | end | ||
toTableEnd(configOrder, property.order) | toTableEnd(configOrder, property.order) | ||
Zeile 327: | Zeile 347: | ||
end | end | ||
end | end | ||
error('No category match found; please define the category for key "all-all-all-all-all"') | error( | ||
'No category match found;' | |||
.. ' please define the category for key "all-all-all-all-all"' | |||
) | |||
end | end | ||