From 0e44ef231a7b5d541fc0cc7ca89a3db1fa1b838a Mon Sep 17 00:00:00 2001 From: erdivartanovich Date: Mon, 3 Aug 2026 18:31:15 +0800 Subject: 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. --- runtime/lua/nvim/dir.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/nvim/dir.lua') 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 -- cgit