fix(iferr): error handling on error

This commit is contained in:
Smirnov Oleksandr 2024-12-23 22:41:15 +02:00
parent f55c15ada8
commit ac92172ce0
No known key found for this signature in database

View file

@ -14,8 +14,14 @@ function iferr.iferr()
local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%") local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%")
if vim.v.shell_error ~= 0 then if vim.v.shell_error ~= 0 then
error("iferr failed: " .. data) if string.find(data[1], "no functions at") then
log.error("failed. output: " .. data) vim.print "no function found"
log.warn("iferr: no function at " .. boff)
return
end
log.error("failed. output: " .. vim.inspect(data))
error("iferr failed: " .. vim.inspect(data))
end end
vim.fn.append(pos, data) vim.fn.append(pos, data)