diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-26 10:13:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-26 10:13:02 +0800 |
commit | 712347eb8a31ae0b8e6cc1c96fd7f75d152f0719 (patch) | |
tree | 1f598a9d1f477dc4e270f032034feeffae155d0c /server/src/service.lua | |
parent | 443f34432606e736e8d4e8b66412abcd43c01c4e (diff) | |
download | lua-language-server-712347eb8a31ae0b8e6cc1c96fd7f75d152f0719.zip |
调用栈显示到前端
Diffstat (limited to 'server/src/service.lua')
-rw-r--r-- | server/src/service.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index 3d530e4d..ac986bf7 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -36,7 +36,7 @@ function mt:_callMethod(name, params) local f = method[name] if f then local clock = os.clock() - local suc, res = xpcall(f, log.error, self, params) + local suc, res = xpcall(f, debug.traceback, self, params) local passed = os.clock() - clock if passed > 0.1 then log.debug(('Task [%s] takes [%.3f]sec.'):format(name, passed)) @@ -44,14 +44,15 @@ function mt:_callMethod(name, params) if suc then return res else - local suc, res = pcall(table.dump, params) - local dump = suc and res or 'Cyclic table' + local ok, r = pcall(table.dump, params) + local dump = ok and r or 'Cyclic table' log.debug(('Task [%s] failed, params: %s'):format( name, dump )) + log.debug(res) return nil, { code = ErrorCodes.InternalError, - message = res, + message = r .. '\n' .. res, } end end |