Browse Source

refact: use `xpcall` instead of `pcall`

to load configuration files, this should allow us to send a better traceback if something goes wrong
my-config
NTBBloodbath 3 years ago
parent
commit
b907854887
No known key found for this signature in database GPG Key ID: 18D6730BC846AAC5
  1. 2
      lua/doom/core/config/init.lua
  2. 2
      lua/doom/core/config/modules.lua
  3. 2
      lua/doom/core/config/userplugins.lua
  4. 2
      lua/doom/extras/logging/init.lua

2
lua/doom/core/config/init.lua

@ -430,7 +430,7 @@ if ok then
M.config = ret.config
M.source = ret.source
else
ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua")
ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua")
if ok then
M.config = ret.config
M.source = ret.source

2
lua/doom/core/config/modules.lua

@ -93,7 +93,7 @@ if ok then
M.modules = ret.modules
M.source = ret.source
else
ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_modules.lua")
ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_modules.lua")
if ok then
M.modules = ret.modules
M.source = ret.source

2
lua/doom/core/config/userplugins.lua

@ -23,7 +23,7 @@ if ok then
M.plugins = ret.plugins
M.source = ret.source
else
ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_userplugins.lua")
ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_userplugins.lua")
if ok then
M.plugins = ret.plugins
M.source = ret.source

2
lua/doom/extras/logging/init.lua

@ -18,7 +18,7 @@ local ok, ret = pcall(require, "doom_config")
if ok then
logging_level = ret.config.doom.logging or logging_level
else
ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua")
ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua")
if ok then
logging_level = ret.config.doom.logging or logging_level
end

Loading…
Cancel
Save