Try improve error reporting

This commit is contained in:
aaron 2024-12-27 22:43:01 +00:00
parent 3b22f6ccf9
commit 58a31a1b32
16 changed files with 164 additions and 55 deletions

View file

@ -1,5 +1,4 @@
local flags = require "./flags"
local throw = require "./throw"
local graph = require "./graph"
local function batch(setter: () -> ())
@ -11,14 +10,14 @@ local function batch(setter: () -> ())
from = graph.get_update_queue_length()
end
local ok, err: string? = pcall(setter)
local ok, err: string? = xpcall(setter, debug.traceback)
if not already_batching then
flags.batch = false
graph.flush_update_queue(from)
end
if not ok then throw(`error occured while batching updates: {err}`) end
if not ok then error(`error occured while batching updates: {err}`, 0) end
end
return batch