Module:TemplateStarter: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 27: | Line 27: | ||
-- Create error context for better error handling | -- Create error context for better error handling | ||
local errorContext = ErrorHandling.createContext() | local errorContext = ErrorHandling.createContext("TemplateStarter") | ||
-- Protected function to get configuration | -- Protected function to get configuration | ||
| Line 34: | Line 34: | ||
if not config then | if not config then | ||
return nil, string.format("Template type '%s' not found in ConfigRepository", templateType) | |||
end | end | ||
if not config.fields then | if not config.fields then | ||
return nil, string.format("Template type '%s' has no fields configuration", templateType) | |||
end | end | ||
| Line 49: | Line 45: | ||
-- Get configuration with error protection | -- Get configuration with error protection | ||
local | local config = ErrorHandling.protect(errorContext, 'getTemplateConfig', getTemplateConfig, nil) | ||
if | if not config then | ||
return "Error: | return "Error: Failed to load template configuration" | ||
end | end | ||
| Line 73: | Line 69: | ||
end | end | ||
end | end | ||
return true | |||
end | end | ||
-- Process fields with error protection | -- Process fields with error protection | ||
ErrorHandling.protect(errorContext, 'processFields', processFields, false) | |||
-- Close the template | -- Close the template | ||