lua pcall error
来源:互联网 发布:陈道明 左小青 知乎 编辑:程序博客网 时间:2024/05/21 17:19
function main() --抛出异常 throw({retcode = "E001",retmsg = "出错了!!!",})end--捕获异常local ok, result = pcall(main)if not ok then log(m_uuid,"throw err:"..tostring(result) )endERR = {SUCCESS = { retcode = "0000", retmsg = "success" }, SYSTEM_ERROR = { retcode = "E001", retmsg = "system error" },MAC_ERROR = { retcode = "E002", retmsg = "mac error" }, }function throw(err, ret) local SYSTEM_ERROR = ERR.SYSTEM_ERROR if type(err) ~= "table" then error { retcode = SYSTEM_ERROR.retcode, retmsg = string.format("throw : err is %s", tostring(err)), } end if ret and type(ret) ~= "table" then error { retcode = err.retcode, retmsg = tostring(ret) } end ret = ret or err or SYSTEM_ERROR ret.retcode = (err or SYSTEM_ERROR).retcode ret.retmsg = ret.retmsg or err.retmsg error(ret)end
阅读全文
0 0
- lua pcall error
- lua pcall
- Lua的pcall函数
- lua: pcall xpcall debug
- lua pcall 异常处理
- Lua的pcall函数
- Lua的pcall函数
- Lua中的pcall,xpcall
- Lua的pcall函数
- Lua的pcall错误处理
- Lua的pcall错误处理
- pcall
- pcall
- 在Lua的pcall内部崩溃
- Lua 异常处理 pcall xpcall debug
- Lua的pcall错误处理定位行号
- Lua之pcall和xpcall之学习
- Lua中 assert、pcall 的错误处理
- Announcing TensorFlow Lite
- 一张图总结Google C++编程规范(Google C++ Style Guide)
- 欧几里德算法 -- 求最大公约数
- Runtime Permissions(郭霖CSDN公开课)
- HLS-序
- lua pcall error
- SVN服务器搭建和使用(一)
- 一起学并发编程
- Request的getParameter和getAttribute方法的区别
- 优达学城《计算机科学导论》小结
- 【实用】SAP修改记录表开发
- 《20171113》
- Linux安装图形化桌面
- 如何将arm-linux-gcc编译的动态链接helloworld在Android上运行