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.
This commit is contained in:
erdivartanovich
2026-08-03 18:31:15 +08:00
parent d80121327f
commit 0e44ef231a
2 changed files with 22 additions and 0 deletions

View File

@@ -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