[ 
https://issues.apache.org/jira/browse/THRIFT-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14095351#comment-14095351
 ] 

Roger Meier commented on THRIFT-2659:
-------------------------------------

please analyse TException Handling in C++, it works there.

> python Test Server fails when throwing TException
> -------------------------------------------------
>
>                 Key: THRIFT-2659
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2659
>             Project: Thrift
>          Issue Type: Sub-task
>          Components: Python - Compiler, Python - Library, Test Suite
>            Reporter: Chamila Dilshan Wijayarathna
>              Labels: gsoc2014
>
> As ThriftTest.thrift has defined TestException has 3 scenarios.
> if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
> else if arg == "TException" throw TException
> else do not throw anything
> But when testException("TException") is called, python server is failing 
> saying 
> testException(TException)
> ERROR:root:This is a TException
> Traceback (most recent call last):
>   File "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/server/TServer.py", 
> line 86, in serve
>     self.processor.process(iprot, oprot)
>   File "py/gen-py/ThriftTest/ThriftTest.py", line 1006, in process
>     self._processMap[name](self, seqid, iprot, oprot)
>   File "py/gen-py/ThriftTest/ThriftTest.py", line 1202, in 
> process_testException
>     self._handler.testException(args.arg)
>   File "py/TestServer.py", line 115, in testException
>     raise TException(message='This is a TException')
> TException: This is a TException
> It looks like this causes since auto generated 
> gen-py/ThriftTest/ThriftTest.py doesn't catch TException.
> def process_testException(self, seqid, iprot, oprot):
>     args = testException_args()
>     args.read(iprot)
>     iprot.readMessageEnd()
>     result = testException_result()
>     try:
>       self._handler.testException(args.arg)
>     except Xception, err1:
>       result.err1 = err1
>     oprot.writeMessageBegin("testException", TMessageType.REPLY, seqid)
>     result.write(oprot)
>     oprot.writeMessageEnd()
>     oprot.trans.flush()



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to