Module:Protection banner: Difference between revisions

make the category name function errors more descriptive
Enwikipedia>Mr. Stradivarius
(fix category name function comments)
Enwikipedia>Mr. Stradivarius
(make the category name function errors more descriptive)
Line 226:
local propertiesKey = categoryOrder[i]
if not propertiesKey then
error(local msg = 'no propertiesentry found for key ')
.. i
.. ' in the cfg.reasons.'
.. reason
.. '.categoryOrder table'
error('dupe detected'msg)
end
local property = properties[propertiesKey]
if not property then
error(local msg = 'invalid propertiesvalue key"')
.. propertiesKey
.. '" detected in the cfg.reasons.'
.. reason
.. '.categoryOrder table'
error(msg)
end
if dupes[propertypropertiesKey] then
local msg = 'duplicate values "'
error('dupe detected')
.. propertiesKey
.. '" detected in the cfg.reasons.'
.. reason
.. '.categoryOrder table'
error(msg)
else
dupes[propertypropertiesKey] = true
end
configOrder[i] = property
Line 246 ⟶ 261:
local property = properties[categoryOrder]
if not property then
local msg = '"'
error('invalid category order string')
.. categoryOrder
.. '" is not a valid value of cfg.reasons.'
.. reason
.. '.categoryOrder'
error(msg)
end
toTableEnd(configOrder, property.order)
Line 327 ⟶ 347:
end
end
error(
error('No category match found; please define the category for key "all-all-all-all-all"')
'No category match found;'
error( .. 'No category match found; please define the category for key "all-all-all-all-all"')
)
end