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:
parent
458911fe8d
commit
6aad3ef432
@ -74,10 +74,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
premake.override(_G, "require", function(base, modname, versions)
|
premake.override(_G, "require", function(base, modname, versions)
|
||||||
local result, mod = pcall(base,modname)
|
local result, mod = xpcall(base(modname), debug.traceback)
|
||||||
if not result then
|
|
||||||
error( mod, 3 )
|
|
||||||
end
|
|
||||||
if mod and versions and not premake.checkVersion(mod._VERSION, versions) then
|
if mod and versions and not premake.checkVersion(mod._VERSION, versions) then
|
||||||
error(string.format("module %s %s does not meet version criteria %s",
|
error(string.format("module %s %s does not meet version criteria %s",
|
||||||
modname, mod._VERSION or "(none)", versions), 3)
|
modname, mod._VERSION or "(none)", versions), 3)
|
||||||
|
Reference in New Issue
Block a user