THRIFT-5260 Fix the thrift compiler generate problematic lua code for the oneway method
Client: lua
Patch: longzhiri <persistentsnail@gmail.com>
This closes #2212
The oneway method's processor has no need to write the result to client, but it is necessary to return values of each handler's return.
diff --git a/lib/lua/TServer.lua b/lib/lua/TServer.lua
index 4e37d58..9afe19e 100644
--- a/lib/lua/TServer.lua
+++ b/lib/lua/TServer.lua
@@ -85,9 +85,17 @@
end
end
+function TServer:setExceptionHandler(exceptionHandler)
+ self.exceptionHandler = exceptionHandler
+end
+
function TServer:_handleException(err)
if string.find(err, 'TTransportException') == nil then
- print(err)
+ if self.exceptionHandler then
+ self.exceptionHandler(err)
+ else
+ print(err)
+ end
end
end