From 2782f8125e793940f5bf942af1a1df0bbc989d11 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 23:42:05 +0200 Subject: [PATCH] fix(profiling): ensure proper traces in case of require errors --- lua/lazy/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lazy/init.lua b/lua/lazy/init.lua index e219eaf..75ccfa2 100644 --- a/lua/lazy/init.lua +++ b/lua/lazy/init.lua @@ -10,8 +10,13 @@ local function profile_require() if Util and not done[modname] then done[modname] = true Util.track({ require = modname }) - local ret = vim.F.pack_len(r(modname)) + local ok, ret = pcall(function() + return vim.F.pack_len(r(modname)) + end) Util.track() + if not ok then + error(ret, 2) + end return vim.F.unpack_len(ret) else return r(modname)