From 712347eb8a31ae0b8e6cc1c96fd7f75d152f0719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 26 Dec 2018 10:13:02 +0800 Subject: =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=A0=88=E6=98=BE=E7=A4=BA=E5=88=B0?= =?UTF-8?q?=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + server/src/service.lua | 9 +++++---- 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 -- cgit v1.2.3