Jump to content

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
error('no properties key')
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
error('invalid properties key')
local msg = 'invalid value "'
.. propertiesKey
.. '" detected in the cfg.reasons.'
.. reason
.. '.categoryOrder table'
error(msg)
end
end
if dupes[property] then
if dupes[propertiesKey] then
error('dupe detected')
local msg = 'duplicate values "'
.. propertiesKey
.. '" detected in the cfg.reasons.'
.. reason
.. '.categoryOrder table'
error(msg)
else
else
dupes[property] = true
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('invalid category order string')
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


Cookies help us deliver our services. By using our services, you agree to our use of cookies.