From f4a17dd48c2aa8cc2ded9fb205200a107e884a1e Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sun, 17 Aug 2008 13:31:15 +0000 Subject: [PATCH] Adding error messages to debug function, fixed a typo --- DressToKill.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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"]) -- 1.7.9.5