Merge pull request #189 from moomalade/loadmodule_error
Improve module loadfile() error messages
This commit is contained in:
commit
247699e6ce
@ -68,6 +68,9 @@
|
||||
if chunk then
|
||||
return chunk
|
||||
end
|
||||
if err then
|
||||
return "\n\tload error " .. err
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,7 +74,10 @@
|
||||
---
|
||||
|
||||
premake.override(_G, "require", function(base, modname, versions)
|
||||
local mod = base(modname)
|
||||
local result, mod = pcall(base,modname)
|
||||
if not result then
|
||||
error( mod, 3 )
|
||||
end
|
||||
if mod and versions and not premake.checkVersion(mod._VERSION, versions) then
|
||||
error(string.format("module %s %s does not meet version criteria %s",
|
||||
modname, mod._VERSION or "(none)", versions), 3)
|
||||
|
Reference in New Issue
Block a user