Modul:Error
-- @brief-- Error handling.-- -- @author-- [[meta:User:Danny B.]]local Error = {}----------------------------------------Error.commonTypes = {missingValue = {message = "Chybí hodnota",category = "Doplnit hodnotu"},unknownValue = {message = "Neznámá hodnota",category = "Opravit hodnotu"},wrongType = {message = "Špatný formát",category = "Opravit formát"}}-- @brief-- Generate the error message.-- -- @param-- errorData Table-- -- @return-- Wikitextfunction Error.getMessage( errorData )local outputlocal template = mw.text.trim( errorData.template or "" )local text = mw.text.trim( errorData.text or "" )for key, value in pairs( Error.commonTypes ) doif errorData[key] thentext = Error.commonTypes[key].message .. " "if tonumber( errorData[key].paramName ) thentext = text .. errorData[key].paramName .. ". parametru"elsetext = text .. "parametru „" .. errorData[key].paramName .. "“"endtext = text .. " (" .. errorData[key].paramDesc .. ")."endendif template ~= "" thentemplate = "<nowiki>{{</nowiki>[[Šablona:" .. template .. "|" .. template .. "]]<nowiki>}}</nowiki> — "endif text ~= "" thentext = ": " .. template .. textelseif template ~= "" thentext = ": " .. template .. "Chybné vložení."endoutput = "<strong class=\"error\">CHYBA" .. text .. "</strong>"return outputend-- @brief-- Generate the error category.-- -- @param-- errorData Table-- -- @return-- Wikitextfunction Error.getCategory( errorData )local outputlocal template = mw.text.trim( errorData.template or "" )local category = mw.text.trim( errorData.category or "" )for key, value in pairs( Error.commonTypes ) doif errorData[key] thencategory = Error.commonTypes[key].category .. " "if tonumber( errorData[key].paramName ) thencategory = category .. errorData[key].paramName .. ". parametru"elsecategory = category .. "parametru „" .. errorData[key].paramName .. "“"endendendif category ~= "" thenif template ~= "" thencategory = category .. " v šabloně " .. templateendelsecategory = mw.text.trim( "Opravit chybné volání šablony " .. template )endoutput = "[[Kategorie:Údržba:" .. category .. "]]"return outputend-- @brief-- Generate the error message and error category.-- -- @param-- errorData Table-- -- @return-- Wikitextfunction Error.getText( errorData )local output = ""output = output .. Error.getMessage( errorData )output = output .. "<includeonly>" .. Error.getCategory( errorData ) .. "</includeonly>"return outputend----------------------------------------return Error
🔥 Top keywords: Hlavní stranaRobert FicoSpeciální:HledáníVlastimil HarapesJuraj CintulaMistrovství světa v ledním hokeji 2024Elena StrupkováAtentát na Roberta FicaMistrovství světa v ledním hokejiNová KaledonieSvetlana FicováRadko GudasPeter PellegriniJosef TopolMistrovství světa v ledním hokeji 2023Alexander SalákTomáš HanusRobert KaliňákSpeciální:Poslední změnyVražda Jána Kuciaka a Martiny KušnírovéDagmar KřížkováPrezidentské volby na Slovensku 2024Zdeňka Žádníková-VolencováSurvivor Česko & Slovensko: Titáni vs. LovciÚtok na Václava Klause v ChrastavěČeská hokejová reprezentaceČeskoMatúš Šutaj EštokMarek ŽeníšekJakub VoráčekZuzana ČaputováHandlováFilip TopolMistrovství světa v ledním hokeji 2022Mistrovství světa v ledním hokeji 2025Pryskyřník prudkýRammsteinKarel IV.Štědřenec odvislý