mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
use xpcall and get backtrace
This commit is contained in:
parent
df340f7104
commit
da1bc6f8ec
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user