diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-30 10:46:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-30 10:46:41 +0800 |
commit | 610fe9243f785c2388321d5ea84ca3973bea9dfc (patch) | |
tree | 3f3d9c26a3f386c127c2dbc758c7eeb02ea99e85 /script/proto | |
parent | 6f30515d360b3eb5edcda9c2233edb11f238d870 (diff) | |
download | lua-language-server-610fe9243f785c2388321d5ea84ca3973bea9dfc.zip |
response error logs request method
Diffstat (limited to 'script/proto')
-rw-r--r-- | script/proto/proto.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/script/proto/proto.lua b/script/proto/proto.lua index 5cc61b24..a0758ac3 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -76,9 +76,13 @@ function m.awaitRequest(name, params) } --log.debug('Request', name, #buf) io.stdout:write(buf) - return await.wait(function (resume) + local result, error = await.wait(function (resume) m.waiting[id] = resume end) + if error then + log.warn(('Response of [%s] error [%d]: %s'):format(name, error.code, error.message)) + end + return result end function m.doMethod(proto) @@ -130,8 +134,7 @@ function m.doResponse(proto) end m.waiting[id] = nil if proto.error then - log.warn(('Response error [%d]: %s'):format(proto.error.code, proto.error.message)) - resume(nil) + resume(nil, proto.error) return end resume(proto.result) |