User defined exceptions shouldn't derive from TException
--------------------------------------------------------
Key: THRIFT-724
URL: https://issues.apache.org/jira/browse/THRIFT-724
Project: Thrift
Issue Type: Bug
Components: Compiler (C++)
Affects Versions: 0.2
Reporter: Adam Simpkins
Priority: Minor
The thrift C++ compiler currently emits code so that user-defined exception
types derive from TException rather than std::exception. Several of our
developers have been confused by this, because they want to use TException's
internal message_ field, which isn't passed across the wire. (Part of the
reason for this is that TException::what() returns message_, so when a server
throws an exception and they try to print it in the client, they just get
"Default TException". They then look at the code, and assume they need to set
message_.)
To reduce this confusion and make it more clear that TException is purely for
thrift's local errors, user defined exceptions should just derive from
std::exception. This is how the code generated for most of the other languages
works.
It looks like perl and ruby also derive user-defined exceptions from the thrift
base exception type. If we fix this for C++, we should fix these other
languages
too.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.