Module:T-Norm: Difference between revisions

// via Wikitext Extension for VSCode
Tag: Reverted
// via Wikitext Extension for VSCode
Tag: Manual revert
 
(One intermediate revision by the same user not shown)
Line 48: Line 48:


-- SPECIAL SEMANTIC MAPPINGS GO HERE
-- SPECIAL SEMANTIC MAPPINGS GO HERE
-- Add a custom field processor that will trigger an error for testing
template.processors = template.processors or {}
template.processors.testErrorField = function(value, args, template)
    -- This will cause a controlled error: attempt to index a nil value
    local nilTable = nil
    local result = nilTable.nonExistentProperty -- This will trigger "attempt to index a nil value"
    return value
end


-- ================================================================================
-- ================================================================================
Line 64: Line 55:
Blueprint.addPreprocessor(template, 'setPageIdField')  -- Blueprint default
Blueprint.addPreprocessor(template, 'setPageIdField')  -- Blueprint default
Blueprint.addPreprocessor(template, 'deriveRegionFromCountry') -- Possible blueprint default
Blueprint.addPreprocessor(template, 'deriveRegionFromCountry') -- Possible blueprint default
-- Test error: Add a controlled error within the rendering pipeline
Blueprint.addPreprocessor(template, function(template, args)
    -- Add a test field that will cause an error during field processing
    if args.name and args.name:lower():find("test") then
        args.testErrorField = "trigger_error"
    end
    return args
end)


-- ==================== Main Render Function ====================
-- ==================== Main Render Function ====================
Line 81: Line 63:
         "render",
         "render",
         function()
         function()
            -- Test error: Add a direct error that will be caught by our error handling
            local args = frame.args or {}
            if args.name and args.name:lower():find("test") then
                -- This will trigger "attempt to perform arithmetic on a string value"
                local errorResult = args.name + 42
            end
           
             return template.render(frame)
             return template.render(frame)
         end,
         end,