fix: catch callback errors

very ugly code! will need a fix rust-side...
This commit is contained in:
əlemi 2024-09-18 00:28:01 +02:00
parent 6b3e4a3faa
commit 51d6628fd4
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -45,9 +45,13 @@ if CODEMP == nil then
CODEMP.timer = vim.loop.new_timer()
CODEMP.timer:start(CODEMP.config.timer_interval, CODEMP.config.timer_interval, function()
while true do
local cb, arg = CODEMP.native.poll_callback()
if cb == nil then break end
vim.schedule(function() cb(arg) end)
local success, cb, arg = pcall(CODEMP.native.poll_callback)
if not success then
print(vim.inspect(cb))
else
if cb == nil then break end
vim.schedule(function() cb(arg) end)
end
end
end)