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
|
||||
|
||||
local tree
|
||||
local pass, err = pcall(function(...)
|
||||
tree = self._g:match(str, ...)
|
||||
end, ...)
|
||||
local parse_args = {...}
|
||||
|
||||
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
|
||||
if type(err) == "string" then
|
||||
error(err)
|
||||
return nil, err
|
||||
end
|
||||
|
||||
if not tree then
|
||||
|
Loading…
Reference in New Issue
Block a user