@@ -14,13 +14,14 @@ local Global = require 'utils.global'
1414local floor = math.floor
1515local log10 = math.log10
1616local Token_get = Token .get
17- local pcall = pcall
17+ local xpcall = xpcall
1818local Queue_peek = Queue .peek
1919local Queue_pop = Queue .pop
2020local Queue_push = Queue .push
2121local PriorityQueue_peek = PriorityQueue .peek
2222local PriorityQueue_pop = PriorityQueue .pop
2323local PriorityQueue_push = PriorityQueue .push
24+ local error_handler = ErrorLogging .error_handler
2425
2526local Task = {}
2627
@@ -69,13 +70,12 @@ local function on_tick()
6970 local task = Queue_peek (task_queue )
7071 if task ~= nil then
7172 -- result is error if not success else result is a boolean for if the task should stay in the queue.
72- local success , result = pcall (Token_get (task .func_token ), task .params )
73+ local success , result = xpcall (Token_get (task .func_token ), error_handler , task .params )
7374 if not success then
7475 if _DEBUG then
7576 error (result )
7677 else
7778 log (result )
78- ErrorLogging .generate_error_report (result )
7979 end
8080 Queue_pop (task_queue )
8181 primitives .total_task_weight = primitives .total_task_weight - task .weight
@@ -88,13 +88,12 @@ local function on_tick()
8888
8989 local callback = PriorityQueue_peek (callbacks )
9090 while callback ~= nil and tick >= callback .time do
91- local success , result = pcall (Token_get (callback .func_token ), callback .params )
91+ local success , result = xpcall (Token_get (callback .func_token ), error_handler , callback .params )
9292 if not success then
9393 if _DEBUG then
9494 error (result )
9595 else
9696 log (result )
97- ErrorLogging .generate_error_report (result )
9897 end
9998 end
10099 PriorityQueue_pop (callbacks )
0 commit comments