Module:Article history: Difference between revisions

Content deleted Content added
better name for parseConfigVal
add error message for action objects with no code passed, and set the level for errors using Message:raiseError to zero
Line 80:
end
 
function Message:raiseError(msg, help, level)
local errorText
if help then
Line 87:
errorText = self:message('error-message-nohelp', msg)
end
error(errorText, level0)
level = tonumber(level)
if level and level > 0 then
level = level + 1
end
error(errorText, level)
end
 
Line 266 ⟶ 262:
local Action = setmetatable({}, Row)
Action.__index = Action
 
-- Properties to implement:
-- * id
-- * oldid
-- * paramNum
-- * cfg
-- * actionCfg
-- * currentTitle
 
function Action.new(data)
-- Valid data table keys:
-- code, result, link, paramNum, cfg, currentTitle
local obj = Row.new(data)
setmetatable(obj, Action)
Line 284 ⟶ 270:
 
-- Set the ID
if not data.code then
local codeParam = self.cfg.actionParamPrefix .. tostring(obj.paramNum)
self:raiseError(
self:message('action-error-no-code', codeParam),
self:message('action-error-no-code-help')
)
end
obj.id = obj.cfg.actions[data.code] and obj.cfg.actions[data.code].id
if not obj.id then