Adding error messages to debug function, fixed a typo
James Whitehead II [08-17-08 - 13:31]
Adding error messages to debug function, fixed a typo
diff --git a/DressToKill.lua b/DressToKill.lua
index 6a3884a..624edcd 100644
--- a/DressToKill.lua
+++ b/DressToKill.lua
@@ -8,7 +8,12 @@ local DEBUG = false
local function debug(fmt, ...)
local msg = "|cffffff78DressToKill:|r "
if select("#", ...) > 0 then
- msg = msg .. fmt:format(...)
+ local succ,err = pcall(string.format, fmt, ...)
+ if not succ then
+ error(debugstack())
+ else
+ msg = msg .. err
+ end
else
msg = msg .. fmt
end
@@ -176,7 +181,7 @@ local function scanFunction(weightFunction)
debug(L["Successfully equipped %s"], link)
local mh_link = GetInventoryItemLink("player", mainslot)
local mh_score = weightFunction(mh_link, mainslot) - mh_base
- debug(L["Mainhand score: %d"], score)
+ debug(L["Mainhand score: %d"], mh_score)
if not IsEquippedItemType("Two-Hand") then
debug(L["This is a one hand weapon, try offhand weapons"])