Quantcast

Updated with new errors to catch

Xruptor [10-09-16 - 14:52]
Updated with new errors to catch
-Added a new extra catch for errors just in case the custom ones are not caught
Filename
errorList.lua
xanErrorDevourer.lua
xanErrorDevourer.toc
diff --git a/errorList.lua b/errorList.lua
index c1f6cd9..9f9d38d 100644
--- a/errorList.lua
+++ b/errorList.lua
@@ -48,7 +48,15 @@ xErrD = {
 	[SPELL_FAILED_AFFECTING_COMBAT] = true, --You are in combat
 	[SPELL_FAILED_TOO_CLOSE] = true,  --Target to close.
 	[ERR_BADATTACKPOS] = true, --you are too far away
-	[SPELL_FAILED_TARGET_FRIENDLY] = false, --target is friendly
+	[SPELL_FAILED_TARGET_FRIENDLY] = false, --target is friendly,
+	[ERR_POTION_COOLDOWN] = false, --You cannot drink any more yet.
+	[ERR_ITEM_COOLDOWN] = false,
+	[SPELL_FAILED_MOVING] = false,
+	[SPELL_FAILED_TARGET_AURASTATE] = false, --You can't do that yet
+	[SPELL_FAILED_NO_ENDURANCE] = false,
+	[SPELL_FAILED_NOT_MOUNTED] = false, --you are mounted
+	[SPELL_FAILED_NOT_ON_TAXI] = false, --you are in flight
+	[ERR_PET_SPELL_OUT_OF_RANGE] = false, --Your pet is out of range.
 }

 --localized error messages
diff --git a/xanErrorDevourer.lua b/xanErrorDevourer.lua
index 9817c2a..56fd3c6 100644
--- a/xanErrorDevourer.lua
+++ b/xanErrorDevourer.lua
@@ -8,6 +8,7 @@

 local storedBarCount = 0
 local prevClickedBar
+local errorList = ""

 local xED_Frame = CreateFrame("frame","xanErrorDevourer",UIParent)
 xED_Frame:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
@@ -17,6 +18,13 @@ local function Debug(...)
     if debugf then debugf:AddMessage(string.join(", ", tostringall(...))) end
 end

+local function updateErrorList()
+	errorList = ""
+	for k, v in pairs(xErrD_DB) do
+		errorList = errorList.."|"..string.lower(k)
+	end
+end
+
 --[[------------------------
 	ENABLE
 --------------------------]]
@@ -47,6 +55,9 @@ function xED_Frame:PLAYER_LOGIN()
 		xErrD_DB.dbver = ver
 	end

+	--update error list
+	updateErrorList()
+
 	--populate scroll
 	xED_Frame:DoErrorList()

@@ -68,7 +79,18 @@ end
 local originalOnEvent = UIErrorsFrame:GetScript("OnEvent")
 UIErrorsFrame:SetScript("OnEvent", function(self, event, msg, r, g, b, ...)
 	--only allow errors that aren't in our list
-	if msg and not xErrD_DB[string.lower(msg)] then
+	if msg then
+
+		--check out DB
+		if xErrD_DB[string.lower(msg)] then
+			return
+		end
+		--check with find in string
+		if errorList and string.find(errorList, string.lower(msg)) then
+			return
+		end
+
+		--return original
 		return originalOnEvent(self, event, msg, r, g, b, ...)
 	end
 end)
@@ -146,6 +168,8 @@ RemErrorBTN:SetScript("OnClick", function()
 		if xErrD_DB[prevClickedBar.xData.name] then
 			xErrD_DB[prevClickedBar.xData.name] = nil --remove from currently active
 		end
+		--update error list
+		updateErrorList()
 		--refresh the scroll
 		xED_Frame:DoErrorList()
 	end
@@ -283,6 +307,8 @@ function xED_Frame:DoErrorList()
 					--delete it if it exsists
 					if xErrD_DB[self.xData.name] then xErrD_DB[self.xData.name] = nil end
 				end
+				--update error list
+				updateErrorList()
 			end
 			--highlight the bar ;)
 			self:GetParent():Click()
@@ -319,6 +345,9 @@ function xED_Frame:processAdd(err)
 	xErrD_CDB[err] = true --lets add it to the custom DB
 	xErrD_DB[err] = true --lets automatically enable it

+	--update error list
+	updateErrorList()
+
 	--refresh the scroll
 	xED_Frame:DoErrorList()
 end
diff --git a/xanErrorDevourer.toc b/xanErrorDevourer.toc
index 725741d..d7e254e 100644
--- a/xanErrorDevourer.toc
+++ b/xanErrorDevourer.toc
@@ -2,7 +2,7 @@
 ## Title: xanErrorDevourer
 ## Notes: This addon devours errors. Nom-Nom-Nom Errors!
 ## Author: Xruptor
-## Version: 1.9
+## Version: 2.0
 ## OptionalDeps: tekDebug
 ## SavedVariables: xErrD_DB, xErrD_CDB