[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

fix(iferr): improve error handling (#75)

authored by olexsmir.xyz and committed by GitHub 0ed14a40 f55c15ad

Changed files
+8 -2
lua
gopher
+8 -2
lua/gopher/iferr.lua
··· 14 15 local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%") 16 if vim.v.shell_error ~= 0 then 17 - error("iferr failed: " .. data) 18 - log.error("failed. output: " .. data) 19 end 20 21 vim.fn.append(pos, data)
··· 14 15 local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%") 16 if vim.v.shell_error ~= 0 then 17 + if string.find(data[1], "no functions at") then 18 + vim.print "no function found" 19 + log.warn("iferr: no function at " .. boff) 20 + return 21 + end 22 + 23 + log.error("failed. output: " .. vim.inspect(data)) 24 + error("iferr failed: " .. vim.inspect(data)) 25 end 26 27 vim.fn.append(pos, data)