Switch 'require' to use xpcall for error handling.

In particular, this gives the original stack trace where an error actually occurred.
This commit is contained in:
triton 2015-09-10 03:18:48 +01:00
parent 458911fe8d
commit 6aad3ef432

View File

@ -74,10 +74,7 @@
---
premake.override(_G, "require", function(base, modname, versions)
local result, mod = pcall(base,modname)
if not result then
error( mod, 3 )
end
local result, mod = xpcall(base(modname), debug.traceback)
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)