alibaba/wax

How to implement @try in LUA?

lovecactus opened this issue · 1 comments

Is this possible in wax? Thanks!

local unsafeFun = function()
        --put your code here which may cause exception 
        self:testThrowException({1,2});
    end

    local ret, msg = pcall(unsafeFun);
    if ret == false then
        --exception happened
    end
    print("ret=" .. tostring(ret) .." msg=" .. tostring(msg))