feat: error handler for loading modules, config and init, with custom error formatting

This commit is contained in:
Folke Lemaitre 2022-11-25 22:50:17 +01:00
parent bad1b1f87d
commit 7933ae11c4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 56 additions and 7 deletions

View file

@ -154,7 +154,7 @@ function M.init_plugins()
end
if plugin.init then
Util.track(plugin.name)
plugin.init()
Util.try(plugin.init, "Failed to run `init` for **" .. plugin.name .. "**")
Util.track()
end
if plugin.opt == false then
@ -235,7 +235,7 @@ function M.load(plugins, reason, opts)
end
if plugin.config then
plugin.config()
Util.try(plugin.config, "Failed to run `config` for " .. plugin.name)
end
plugin.loaded.time = Util.track().time