You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Martin Smith (JIRA)" <ji...@apache.org> on 2008/12/18 01:42:44 UTC
[jira] Created: (THRIFT-237) Update Exception class generation to
TException decendent
Update Exception class generation to TException decendent
---------------------------------------------------------
Key: THRIFT-237
URL: https://issues.apache.org/jira/browse/THRIFT-237
Project: Thrift
Issue Type: Improvement
Components: Compiler (C#), Compiler (Cocoa), Compiler (Java), Compiler (Python)
Environment: Java
Reporter: Martin Smith
Priority: Trivial
Make all generated Exception objects derived classes of TExceptions instead of Exceptions. This allows callers to handle all errors of their service by catching TException, eliminating the need for multiple catch blocks where not required by the client code.
This follows the more recent patterns set for C++, PHP, Perl.
The languages affects are
Java, python, Cocoa, csharp
This could negatively affect code where the base exception class TException is handled prior to the generated exception classes.
e.g.
try {
} catch (TException te) {
} catch (ThriftAppException tae) {
}
Patch available for Java, can build patches for python, cocoa and csharp at the same time.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-237) Update Exception class generation to
TException decendent
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657640#action_12657640 ]
Bryan Duxbury commented on THRIFT-237:
--------------------------------------
Maybe every Thrift file should have a default exception base class, and then all the exceptions defined in that file derive from that? I'm a little worried that deriving everything from TException sort of muddles what you're getting. I see a TException as a problem from the library, not user code.
> Update Exception class generation to TException decendent
> ---------------------------------------------------------
>
> Key: THRIFT-237
> URL: https://issues.apache.org/jira/browse/THRIFT-237
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (C#), Compiler (Cocoa), Compiler (Java), Compiler (Python)
> Environment: Java
> Reporter: Martin Smith
> Priority: Trivial
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> Make all generated Exception objects derived classes of TExceptions instead of Exceptions. This allows callers to handle all errors of their service by catching TException, eliminating the need for multiple catch blocks where not required by the client code.
> This follows the more recent patterns set for C++, PHP, Perl.
> The languages affects are
> Java, python, Cocoa, csharp
> This could negatively affect code where the base exception class TException is handled prior to the generated exception classes.
> e.g.
> try {
> } catch (TException te) {
> } catch (ThriftAppException tae) {
> }
> Patch available for Java, can build patches for python, cocoa and csharp at the same time.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-237) Update Exception class generation to
TException decendent
Posted by "Martin Smith (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657659#action_12657659 ]
Martin Smith commented on THRIFT-237:
-------------------------------------
I think that was the original intent. Perhaps Slee can comment on why we migrated away from that.
For what it's worth, I ran through the language and attempted to build a somewhat accurate map of the exception implementations across languages. Perhaps this will be useful in makings a decision on how to make thrift consistent.
CPP derives from TException, defines a TException and a TApplicationException
PHP derives from TException and defines a TException and a TApplicationException
Perl derives from TException and defines a TException and a TApplicationException
Python derives from TException and defines a TException and a TApplicationException
Cocoa derives from the language base NSException and defines a TException and a TApplicationException
Java derives from the language base Exception and defines a TException and a TApplicationException
OCaml derives from the language base exception and defines a t_exn and a Application_Exn
Ruby derives from StandardError (base language?) and defines an Exception and a ApplicationException and a deprecated symbol TException and TApplicationException
CSharp derives from the language base Exception and defines only a TApplicationException
Squeak derives from Error and defines a TError and a suit of TProtocolErrors and TApplicationErrors
Erlang, Haskell... I have no clue.
> Update Exception class generation to TException decendent
> ---------------------------------------------------------
>
> Key: THRIFT-237
> URL: https://issues.apache.org/jira/browse/THRIFT-237
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (C#), Compiler (Cocoa), Compiler (Java), Compiler (Python)
> Environment: Java
> Reporter: Martin Smith
> Priority: Trivial
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> Make all generated Exception objects derived classes of TExceptions instead of Exceptions. This allows callers to handle all errors of their service by catching TException, eliminating the need for multiple catch blocks where not required by the client code.
> This follows the more recent patterns set for C++, PHP, Perl.
> The languages affects are
> Java, python, Cocoa, csharp
> This could negatively affect code where the base exception class TException is handled prior to the generated exception classes.
> e.g.
> try {
> } catch (TException te) {
> } catch (ThriftAppException tae) {
> }
> Patch available for Java, can build patches for python, cocoa and csharp at the same time.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.