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

mudit saxena edited comment on THRIFT-2935 at 3/17/15 7:07 AM:
---------------------------------------------------------------

I went through the code for this ticket and according to my understanding 
following things need to be changed/replaced to implement it. As I am beginner 
I would like your help to point out my mistakes or If I have misunderstood 
anything:

1) Custom exceptions block need to be generated in place of TException
2) Dependency of all custom exceptions on TException need to be changed
3) As provided in the above description , can we extend the Exception for any 
custom exception without using TException?




was (Author: mudit):
I went through the code for this ticket and according to my understanding 
following things need to be changed/replaced to implement it. As I am beginner 
I would like your help to point out my mistakes or If I have misunderstood 
anything:

1) Custom exceptions block need to be generated in place of TException
2) Dependency of all custom exceptions on TException need to be changed
3) As provided in the above description , can we extend the Exception for any 
custom exception without using TException?



> Exceptions in Java code should not extends TException
> -----------------------------------------------------
>
>                 Key: THRIFT-2935
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2935
>             Project: Thrift
>          Issue Type: Wish
>          Components: Java - Compiler
>    Affects Versions: 0.9.2
>            Reporter: Sergei Egorov
>              Labels: exception-handling, exceptions, java
>
> Exceptions in Java should not extend TException to avoid collisions on method 
> signature for better IDE support. Currently, if service is throwing some 
> thrift exception, i.e. TMyCustomException, it will have following signature:
> public void myMethod() throws TMyCustomException, TException {
> }
> But TMyCustomException is overlapped by TException,
> Now, if we will call this method in our code:
> client.myMethod();
> IDE will propose to generate try\catch with only 1 block: 
> try {
>    client.myMethod();
> } catch(TException e) {
> }
> Because TMyCustomException extends TException. If TMyCustomException will 
> extends just Exception, than IDE will generate following code:
> try {
>    client.myMethod();
> } catch(TMyCustomException e) {
> } catch(TException e) {
> }
> which is much better, because client caller will know about any custom(!) 
> thrift exception in this method.
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to