aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/nvim/dir.lua
diff options
context:
space:
mode:
authorerdivartanovich <erdivartanovich@gmail.com>2026-08-03 18:31:15 +0800
committererdivartanovich <erdivartanovich@gmail.com>2026-08-04 01:57:21 +0800
commit0e44ef231a7b5d541fc0cc7ca89a3db1fa1b838a (patch)
tree933e42c0dc3fd9ede825c802ff44b6ad6191bb8f /runtime/lua/nvim/dir.lua
parentd80121327fe15663d7f5367f03bb150c748243db (diff)
downloadrneovim-0e44ef231a7b5d541fc0cc7ca89a3db1fa1b838a.tar.gz
rneovim-0e44ef231a7b5d541fc0cc7ca89a3db1fa1b838a.tar.bz2
rneovim-0e44ef231a7b5d541fc0cc7ca89a3db1fa1b838a.zip
fix(dir): do not swallow errors raised after the list callback
Problem: An error raised after the list handler ran (e.g. while rendering) unwinds through the pcall around provider.list() and is routed back into the now no-op handler: silently discarded. Solution: Re-raise the error when the handler has already run.
Diffstat (limited to 'runtime/lua/nvim/dir.lua')
-rw-r--r--runtime/lua/nvim/dir.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/lua/nvim/dir.lua b/runtime/lua/nvim/dir.lua
index 0b60fe4d00..79145525d2 100644
--- a/runtime/lua/nvim/dir.lua
+++ b/runtime/lua/nvim/dir.lua
@@ -268,6 +268,10 @@ function load(buf, name, provider, restore_view, setup, select)
local ok, call_err = pcall(provider.list, buf, name, on_list) ---@type boolean, any
if not ok then
+ if done then
+ -- The handler already ran and would ignore this error: propagate it.
+ error(call_err, 0)
+ end
-- Route provider exceptions through the list handler so failures share one cleanup path.
on_list(tostring(call_err), nil)
end