minor cleanup

This commit is contained in:
kepler155c@gmail.com
2020-05-25 21:48:37 -06:00
parent 1cce4aad03
commit a4f4f34576
5 changed files with 14 additions and 12 deletions

View File

@@ -78,8 +78,6 @@ local function trim_traceback(stack)
end
return function (fn, ...)
-- xpcall in Lua 5.1 does not accept parameters
-- which is not ideal
local args = { ... }
local res = table.pack(xpcall(function()
return fn(table.unpack(args))
@@ -88,6 +86,10 @@ return function (fn, ...)
if not res[1] and res[2] ~= nil then
local err, trace = trim_traceback(res[2])
if err:match(':%d+: 0$') then
return true
end
if #trace > 0 then
_G._syslog('\n' .. err .. '\n' .. 'stack traceback:')
for _, v in ipairs(trace) do
@@ -95,10 +97,6 @@ return function (fn, ...)
end
end
if err:match(':%d+: 0$') then
return true
end
return res[1], err, trace
end