move old systemout to use errorhandler

This commit is contained in:
Michael Freno
2025-12-06 10:43:43 -05:00
parent c7b242a1c8
commit b18592f358
6 changed files with 147 additions and 31 deletions

View File

@@ -629,7 +629,15 @@ function Animation:update(dt, element)
if self.onStart and type(self.onStart) == "function" then
local success, err = pcall(self.onStart, self, element)
if not success then
print(string.format("[Animation] onStart error: %s", tostring(err)))
-- Use ErrorHandler if available via Animation module
if Animation._ErrorHandler then
Animation._ErrorHandler:warn("Animation", "EVT_002", {
callback = "onStart",
error = tostring(err),
})
else
print(string.format("[Animation] onStart error: %s", tostring(err)))
end
end
end
end
@@ -645,7 +653,15 @@ function Animation:update(dt, element)
if self.onComplete and type(self.onComplete) == "function" then
local success, err = pcall(self.onComplete, self, element)
if not success then
print(string.format("[Animation] onComplete error: %s", tostring(err)))
-- Use ErrorHandler if available via Animation module
if Animation._ErrorHandler then
Animation._ErrorHandler:warn("Animation", "EVT_002", {
callback = "onComplete",
error = tostring(err),
})
else
print(string.format("[Animation] onComplete error: %s", tostring(err)))
end
end
end
return true
@@ -678,7 +694,15 @@ function Animation:update(dt, element)
if self.onComplete and type(self.onComplete) == "function" then
local success, err = pcall(self.onComplete, self, element)
if not success then
print(string.format("[Animation] onComplete error: %s", tostring(err)))
-- Use ErrorHandler if available via Animation module
if Animation._ErrorHandler then
Animation._ErrorHandler:warn("Animation", "EVT_002", {
callback = "onComplete",
error = tostring(err),
})
else
print(string.format("[Animation] onComplete error: %s", tostring(err)))
end
end
end
return true
@@ -691,7 +715,15 @@ function Animation:update(dt, element)
local progress = self.elapsed / self.duration
local success, err = pcall(self.onUpdate, self, element, progress)
if not success then
print(string.format("[Animation] onUpdate error: %s", tostring(err)))
-- Use ErrorHandler if available via Animation module
if Animation._ErrorHandler then
Animation._ErrorHandler:warn("Animation", "EVT_002", {
callback = "onUpdate",
error = tostring(err),
})
else
print(string.format("[Animation] onUpdate error: %s", tostring(err)))
end
end
end
@@ -1002,7 +1034,15 @@ function Animation:cancel(element)
if self.onCancel and type(self.onCancel) == "function" then
local success, err = pcall(self.onCancel, self, element)
if not success then
print(string.format("[Animation] onCancel error: %s", tostring(err)))
-- Use ErrorHandler if available via Animation module
if Animation._ErrorHandler then
Animation._ErrorHandler:warn("Animation", "EVT_002", {
callback = "onCancel",
error = tostring(err),
})
else
print(string.format("[Animation] onCancel error: %s", tostring(err)))
end
end
end
end
@@ -1369,7 +1409,15 @@ function AnimationGroup:update(dt, element)
if self.onStart and type(self.onStart) == "function" then
local success, err = pcall(self.onStart, self)
if not success then
print(string.format("[AnimationGroup] onStart error: %s", tostring(err)))
-- Use ErrorHandler if available via AnimationGroup module
if AnimationGroup._ErrorHandler then
AnimationGroup._ErrorHandler:warn("AnimationGroup", "EVT_002", {
callback = "onStart",
error = tostring(err),
})
else
print(string.format("[AnimationGroup] onStart error: %s", tostring(err)))
end
end
end
end
@@ -1389,7 +1437,15 @@ function AnimationGroup:update(dt, element)
if self.onComplete and type(self.onComplete) == "function" then
local success, err = pcall(self.onComplete, self)
if not success then
print(string.format("[AnimationGroup] onComplete error: %s", tostring(err)))
-- Use ErrorHandler if available via AnimationGroup module
if AnimationGroup._ErrorHandler then
AnimationGroup._ErrorHandler:warn("AnimationGroup", "EVT_002", {
callback = "onComplete",
error = tostring(err),
})
else
print(string.format("[AnimationGroup] onComplete error: %s", tostring(err)))
end
end
end
end