Skip to content

Consider using xpcall in try block #1478

Description

@pilaoda

Error message from pcall only include the first line that error happened but not the full stack traceback, but this can be done by compiling to using xpcall and pass debug.traceback as second arg:

local result
local function ____catch(err)
    print("catch:", err)
end
local ____try, ____hasReturned = xpcall(
    function()
        result = dosomething(args)
    end,
    debug.traceback
)
if not ____try then
    ____catch(____hasReturned)
end

Although custom plugin can implement this feature, but plugin can not rewrite lualib such as pcall in Promise.lua

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions