mirror of https://github.com/folke/lazy.nvim.git
style(plugins): more descriptive error when a spec module didnt return any specs
This commit is contained in:
parent
5c89dc52f4
commit
dff6f07290
|
@ -268,7 +268,18 @@ function Spec:import(spec)
|
|||
---@diagnostic disable-next-line: no-unknown
|
||||
package.loaded[modname] = nil
|
||||
Util.try(function()
|
||||
self:normalize(require(modname))
|
||||
local mod = require(modname)
|
||||
if type(mod) ~= "table" then
|
||||
self.importing = nil
|
||||
return self:error(
|
||||
"Invalid spec module: `"
|
||||
.. modname
|
||||
.. "`\nExpected a `table` of specs, but a `"
|
||||
.. type(mod)
|
||||
.. "` was returned instead"
|
||||
)
|
||||
end
|
||||
self:normalize(mod)
|
||||
self.importing = nil
|
||||
Util.track()
|
||||
end, {
|
||||
|
|
Loading…
Reference in New Issue