Skip to content

Commit

Permalink
fix: properly error when failing to load module using `:Neorg module …
Browse files Browse the repository at this point in the history
…load`
  • Loading branch information
vhyrro committed Jul 14, 2024
1 parent 7d9bd33 commit 721fd28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/neorg/modules/core/neorgcmd/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@ module.neorg_post_load = module.public.sync

module.on_event = function(event)
if event.type == "core.neorgcmd.events.module.load" then
modules.load_module(event.content[1])
local ok = pcall(modules.load_module, event.content[1])

if not ok then
vim.notify(string.format("Module `%s` does not exist!", event.content[1]), vim.log.levels.ERROR, {})
end
end

if event.type == "core.neorgcmd.events.module.list" then
Expand Down

0 comments on commit 721fd28

Please sign in to comment.