Module:ErrorHandling: Difference between revisions

// via Wikitext Extension for VSCode
 
// via Wikitext Extension for VSCode
Tag: Reverted
Line 128: Line 128:
      
      
     return result
     return result
end
-- Log field processing information for debugging
-- @param context The error context
-- @param stage The processing stage (e.g., "getFieldValue", "processField")
-- @param fieldKey The field key being processed
-- @param fieldValue The current value of the field
-- @return The error context (for chaining)
function ErrorHandling.logFieldProcessing(context, stage, fieldKey, fieldValue)
    -- Create a unique ID for this log entry
    local logId = "field_" .. context.ERROR_COUNT + 1
    context.ERROR_COUNT = context.ERROR_COUNT + 1
   
    -- Add the log entry with field processing details
    table.insert(context.ERRORS, {
        id = logId,
        source = "FieldProcessing",
        message = stage .. ": " .. (fieldKey or "unknown"),
        details = "Value: " .. (type(fieldValue) == "string" and fieldValue or type(fieldValue)),
        isCritical = false,
        isDebug = true  -- Mark as debug entry
    })
   
    return context
end
end