When getting TProtocolException in stack trace, I see no message:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/happybase/table.py", line 418, in scan
raise e
File "/usr/local/lib/python3.8/site-packages/happybase/table.py", line 415, in scan
items = self.connection.client.scannerGetList(scan_id, how_many)
File "/usr/local/lib/python3.8/site-packages/thriftpy2/thrift.py", line 219, in _req
return self._recv(_api)
File "/usr/local/lib/python3.8/site-packages/thriftpy2/thrift.py", line 231, in _recv
fname, mtype, rseqid = self._iprot.read_message_begin()
File "/usr/local/lib/python3.8/site-packages/thriftpy2/protocol/compact.py", line 145, in read_message_begin
raise TProtocolException(TProtocolException.BAD_VERSION,
thriftpy2.protocol.exc.TProtocolException: TProtocolException(type=4)
Consider the following snippet:
Python 3.8.0 (default, Nov 23 2019, 05:36:56)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from thriftpy2.protocol.exc import TProtocolException
>>> x = TProtocolException(TProtocolException.BAD_VERSION, 'message please')
>>> x
TProtocolException(type=4)
>>> x.message
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'TProtocolException' object has no attribute 'message'
>>> x.args
('message please',)
>>> x.__dict__
{'type': 4}
When getting
TProtocolException
in stack trace, I see no message:Consider the following snippet:
Looks like this is caused by overriding the default
__str__()
inTPayload
: https://github.com/Thriftpy/thriftpy2/blob/master/thriftpy2/thrift.py#L169