all repos

gopher.nvim @ 0ed14a40d9799ac8d92aaf9eb1cd9be22ffd6b14

Minimalistic plugin for Go development
1 files changed, 8 insertions(+), 2 deletions(-)
fix(iferr): improve error handling (#75)

Author: Smirnov Oleksandr ss2316544@gmail.com
Committed by: GitHub noreply@github.com
Committed at: 2024-12-23 22:44:13 +0200
Parent: f55c15a
M lua/gopher/iferr.lua

@@ -14,8 +14,14 @@ local pos = vim.fn.getcurpos()[2]

local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%") if vim.v.shell_error ~= 0 then - error("iferr failed: " .. data) - log.error("failed. output: " .. data) + if string.find(data[1], "no functions at") then + 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 vim.fn.append(pos, data)