You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "David Reiss (JIRA)" <ji...@apache.org> on 2010/03/05 22:09:27 UTC

[jira] Commented: (THRIFT-724) User defined exceptions shouldn't derive from TException

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

David Reiss commented on THRIFT-724:
------------------------------------

I think we should do this.  The biggest risk that I see is that code that currently catches TException and expects to catch user-defined exceptions will have to be changed to catch std::exception.  I doubt too much code is doing this, because it isn't very useful to catch a "Default TException".

> 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.