summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-26 10:13:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-26 10:13:02 +0800
commit712347eb8a31ae0b8e6cc1c96fd7f75d152f0719 (patch)
tree1f598a9d1f477dc4e270f032034feeffae155d0c
parent443f34432606e736e8d4e8b66412abcd43c01c4e (diff)
downloadlua-language-server-712347eb8a31ae0b8e6cc1c96fd7f75d152f0719.zip
调用栈显示到前端
-rw-r--r--README.md1
-rw-r--r--server/src/service.lua9
2 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index 39c868b2..86d0c671 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,7 @@
- [ ] Support Dirty Script
- [ ] Syntax Check
- [ ] Multi Workspace
+- [ ] Type Format
### Locale
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