From 2f60984c90c01eebcae3da0cfe8d063fac567fcb Mon Sep 17 00:00:00 2001 From: Harrison Cramer Date: Thu, 3 Aug 2023 10:22:49 -0400 Subject: [PATCH] BUGFIX: Fix Error Notifications These errors need to be wrapped in a delay call in order to actually work, otherwise we run into this error: https://www.reddit.com/r/neovim/comments/qz4wy6/how_can_i_do_this/ --- lua/gitlab/job.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lua/gitlab/job.lua b/lua/gitlab/job.lua index 0702be1..7e2654e 100644 --- a/lua/gitlab/job.lua +++ b/lua/gitlab/job.lua @@ -19,15 +19,20 @@ M.run_job = function(endpoint, method, body, callback) if callback ~= nil then callback(data) else - vim.notify(data.message, vim.log.levels.DEBUG) + vim.defer_fn(function() + vim.notify(data.message, vim.log.levels.DEBUG) + end, 0) end else - vim.notify("Could not parse command output!", vim.log.levels.ERROR) + vim.defer_fn(function() + vim.notify("Could not parse command output!", vim.log.levels.ERROR) + end, 0) end end, on_stderr = function(_, output) - vim.notify("Could not run command!", vim.log.levels.ERROR) - error(output) + vim.defer_fn(function() + vim.notify("Could not run command!", vim.log.levels.ERROR) + end, 0) end }):start() end