use xpcall and get backtrace

This commit is contained in:
leaf corcoran 2014-02-15 14:07:36 -08:00
parent df340f7104
commit da1bc6f8ec

View File

@ -616,13 +616,17 @@ local build_grammar = wrap_env(function()
end end
local tree local tree
local pass, err = pcall(function(...) local parse_args = {...}
tree = self._g:match(str, ...)
end, ...) local pass, err = xpcall(function()
tree = self._g:match(str, unpack(parse_args))
end, function(err)
return debug.traceback(err, 2)
end)
-- regular error, let it bubble up -- regular error, let it bubble up
if type(err) == "string" then if type(err) == "string" then
error(err) return nil, err
end end
if not tree then if not tree then