diff options
| author | William Boman <william@redwill.se> | 2021-10-01 22:47:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-01 22:47:59 +0200 |
| commit | 8212fc21b6a3c0000b1a5fb4c056c189c6fca212 (patch) | |
| tree | 227a5b8291b6f22184ab4bcf5e18448802c6d296 /lua/nvim-lsp-installer/installers/init.lua | |
| parent | stylua and some cleanup (diff) | |
| download | mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.gz mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.bz2 mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.lz mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.xz mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.zst mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.zip | |
fix newlines in stdout/stderr calls, more robust error handling (#114)
Diffstat (limited to 'lua/nvim-lsp-installer/installers/init.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/init.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lua/nvim-lsp-installer/installers/init.lua b/lua/nvim-lsp-installer/installers/init.lua index 828eba7d..0dd48972 100644 --- a/lua/nvim-lsp-installer/installers/init.lua +++ b/lua/nvim-lsp-installer/installers/init.lua @@ -10,7 +10,7 @@ function M.pipe(installers) return function(server, callback, context) local function execute(idx) - installers[idx](server, function(success) + local ok, err = pcall(installers[idx], server, function(success) if not success then -- oh no, error. exit early callback(success) @@ -22,6 +22,10 @@ function M.pipe(installers) callback(success) end end, context) + if not ok then + context.stdio_sink.stderr(tostring(err) .. "\n") + callback(false) + end end execute(1) @@ -75,7 +79,7 @@ function M.when(platform_table) installer(server, callback, context) else context.stdio_sink.stderr( - ("Current operating system is not yet supported for server %q."):format(server.name) + ("Current operating system is not yet supported for server %q.\n"):format(server.name) ) callback(false) end |
