mirror of https://github.com/bjornbytes/lovr.git
Fix coroutine error handling;
This commit is contained in:
parent
6edd4ec049
commit
4f67fa9a2e
11
etc/boot.lua
11
etc/boot.lua
|
@ -289,10 +289,17 @@ lovr.handlers = setmetatable({}, { __index = lovr })
|
|||
return coroutine.create(function()
|
||||
local function onerror(...)
|
||||
onerror = function(...)
|
||||
print('Error:\n\n' .. tostring(...) .. formatTraceback(debug.traceback('', 3)))
|
||||
print('Error:\n\n' .. tostring(...) .. formatTraceback(debug.traceback('', 1)))
|
||||
return function() return 1 end
|
||||
end
|
||||
return lovr.errhand(...) or function() return 1 end
|
||||
|
||||
local ok, result = pcall(lovr.errhand or onerror, ...)
|
||||
|
||||
if ok then
|
||||
return result or function() return 1 end
|
||||
else
|
||||
return onerror(result)
|
||||
end
|
||||
end
|
||||
|
||||
local thread = select(2, xpcall(lovr.boot, onerror))
|
||||
|
|
Loading…
Reference in New Issue