Open main menu

Changes

Module:Protection banner

593 bytes added, 07:13, 30 June 2014
produce wikitext errors rather than script errors for errors caused by invalid user input
-- Helper functions
--------------------------------------------------------------------------------
 
local function makeWikitextError(msg)
-- @TODO: localise this.
local boilerplate = 'Error: $1 ([[Module:Protection banner#Errors|help]])'
local errorText = mw.message.newRawMessage(boilerplate):params(msg):plain()
return string.format(
'<strong class="error">%s</strong>',
errorText
)
end
local function makeCategoryLink(cat)
dateType,
tostring(dateString)
), 0)
end
self.action = args.action
else
error(string.format( 'Unsupported invalid action ("%s")' .. , tostring(args.action) ), 20)
end
end
-- Initialise the protection object and blurb objectscheck for errors local protectionObjCreated, protectionObj = pcall( Protection.new, Protection, -- equivalent to Protection:new() args, cfg, title ) if not protectionObjCreated then -- protectionObj is the error message. return makeWikitextError(protectionObj) end -- Initialise the blurb object
local blurbObj = Blurb:new(protectionObj, args, cfg)
Anonymous user