From d180dca74d08fe2046ba47621218e3e09077faaa Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Fri, 11 Sep 2020 15:11:28 +0200 Subject: Yield meaningful error messages in iter_cmd{,_sync} when cmd.err == nil --- lua/nvim-treesitter/install.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 61b1a9f9..0d2d7481 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -18,7 +18,9 @@ function M.iter_cmd(cmd_list, i, lang, success_message) handle = luv.spawn(attr.cmd, attr.opts, vim.schedule_wrap(function(code) handle:close() - if code ~= 0 then return api.nvim_err_writeln(attr.err) end + if code ~= 0 then + return api.nvim_err_writeln(attr.err or ("Failed to execute the following command:\n"..vim.inspect(attr))) + end M.iter_cmd(cmd_list, i + 1, lang, success_message) end)) end @@ -49,7 +51,7 @@ local function iter_cmd_sync(cmd_list) vim.fn.system(get_command(cmd)) if vim.v.shell_error ~= 0 then - api.nvim_err_writeln(cmd.err) + api.nvim_err_writeln(cmd.err or ("Failed to execute the following command:\n"..vim.inspect(cmd))) return false end -- cgit v1.2.3