refactor: replace vim.uv.* asserts with warn-and-bail

This commit is contained in:
2026-05-02 22:45:24 +02:00
parent 9568fc63a3
commit 8bd674622e
3 changed files with 32 additions and 8 deletions
+14 -1
View File
@@ -304,7 +304,20 @@ end
---@param delay integer
---@return F, ow.Util.DebounceHandle
function M.debounce(fn, delay)
local timer = assert(vim.uv.new_timer())
local timer, err = vim.uv.new_timer()
if not timer then
M.warning("debounce: failed to create timer: %s", err)
local noop = function() end
return fn,
{
cancel = noop,
flush = noop,
pending = function()
return false
end,
close = noop,
}
end
local args ---@type table?
local gen = 0
local fired_gen = 0