Add debug output and improved error handling for talent export process
- Included debugging logs for class, talent ID count, and mapper state. - Improved error messages for missing or failed `ConvertAscensionTalentsToCalcFormat` function. - Refined failure messages for unsuccessful talent conversions.
This commit is contained in:
@@ -355,7 +355,23 @@ function AE:GenerateMarkdownTalents()
|
||||
|
||||
-- Convert to calculator format using the mapper
|
||||
local _, class = UnitClass("player")
|
||||
local buildString = self.ConvertAscensionTalentsToCalcFormat and self.ConvertAscensionTalentsToCalcFormat(ascensionIds, class)
|
||||
|
||||
-- Debug output
|
||||
table.insert(lines, string.format("*Debug: Class=%s, TalentIDs=%d*\n", tostring(class), #ascensionIds))
|
||||
table.insert(lines, string.format("*Debug: Mapper loaded=%s, Function type=%s*\n",
|
||||
tostring(self._loadedAscensionTalentMapper or false),
|
||||
tostring(type(self.ConvertAscensionTalentsToCalcFormat))))
|
||||
|
||||
if not self.ConvertAscensionTalentsToCalcFormat then
|
||||
table.insert(lines, "*Error: ConvertAscensionTalentsToCalcFormat function not available.*\n")
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
|
||||
local buildString, err = self.ConvertAscensionTalentsToCalcFormat(ascensionIds, class)
|
||||
|
||||
if err then
|
||||
table.insert(lines, string.format("*Conversion error: %s*\n", tostring(err)))
|
||||
end
|
||||
|
||||
if buildString then
|
||||
-- Generate URL for talent calculator
|
||||
@@ -363,11 +379,11 @@ function AE:GenerateMarkdownTalents()
|
||||
table.insert(lines, string.format("[View in Talent Calculator](%s)\n", url))
|
||||
|
||||
-- Embed iframe for Wiki.js
|
||||
table.insert(lines, string.format('<iframe src="/static/talents/?build=%s&embed=true" width="100%%" height="840" style="border: 0px solid #333; border-radius: 8px;"></iframe>\n", buildString))
|
||||
table.insert(lines, string.format('<iframe src="/static/talents/?build=%s&embed=true" width="100%%" height="840" style="border: 0px solid #333; border-radius: 8px;"></iframe>\n', buildString))
|
||||
|
||||
return table.concat(lines, "\n")
|
||||
else
|
||||
table.insert(lines, "*Could not convert talents to calculator format. Only mage class is currently supported.*\n")
|
||||
table.insert(lines, "*Could not convert talents to calculator format (no build string returned).*\n")
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user