You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Chamila Dilshan Wijayarathna (JIRA)" <ji...@apache.org> on 2014/08/12 21:17:12 UTC

[jira] [Created] (THRIFT-2659) python Test Server fails when throwing TException

Chamila Dilshan Wijayarathna created THRIFT-2659:
----------------------------------------------------

             Summary: 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


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)