Module:Protection banner: Difference between revisions
make the category name function errors more descriptive
(fix category name function comments) |
(make the category name function errors more descriptive) |
||
Line 226: | Line 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 | ||
Line 246: | Line 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) | ||
Line 327: | Line 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 | ||