You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- Clear allErrorHandler:ClearErrors()
-- Clear by typelocalremoved=ErrorHandler:ClearErrorsByType("TEST_ERROR")
-- Remove old (older than retention period)localremoved=ErrorHandler:CleanupOldErrors()
Output
-- Print to chatErrorHandler:PrintRecentErrors(5)
-- Format single errorlocalerror=ErrorHandler:GetRecentErrors(1)[1]
localformatted=ErrorHandler:FormatError(error, true) -- with stacklocalformatted=ErrorHandler:FormatError(error, false) -- without stack
Error Record
{
type="ADDON_ACTION_BLOCKED",
message="Addon 'X' tried to call protected function 'Y'",
timestamp=1701878400, -- First occurrencelastSeen=1701878460, -- Last occurrencecount=5, -- Number of times seenstack= { -- Stack trace (array of strings)"file.lua:123: in function",
"file2.lua:456: in function"
}
}
Events Captured
ADDON_ACTION_BLOCKED - Protected function call during combat
ADDON_ACTION_FORBIDDEN - Forbidden function call
LUA_WARNING - Lua runtime warning
Common Patterns
SavedVariables Integration
functionAddon:OnInitialize()
ifMyAddonDB.errorsthenErrorHandler:ImportFromSavedVariables(MyAddonDB.errors)
endendfunctionAddon:OnDisable()
MyAddonDB.errors=ErrorHandler:ExportToSavedVariables()
end
Error Monitoring
C_Timer.NewTicker(300, function()
localstats=ErrorHandler:GetErrorStats()
ifstats.currentlyStored>50thenprint("WARNING: Many errors detected!")
endend)