You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2014/12/20 18:56:13 UTC

[jira] [Comment Edited] (THRIFT-2908) Limited use Thrift::ApplicationException in Ruby

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

Jens Geyer edited comment on THRIFT-2908 at 12/20/14 5:55 PM:
--------------------------------------------------------------

The problem fixed in Delphi was, that an unexpected and uncaught exception thrown in the code could terminate the currently active connection. The fix ensures that any uncaught exceptions are catched and converted into an generic {{TApplication}} exception, and especially that the existing connection stays alive. 

If Ruby has a similar problem we will happily review any patch proposal that you might have. The workaround is to add proper exception handling to all service handler entry points like this (pseudo code):

{code} 
function MyServiceImpl.Foobarize() {
    try {
        // ... some funky cool stuff here ...   
    }
    catch(Exception e) {
        throw new TApplicationException( e.message);
    }
}
{code} 

That's essentially what the patch does. The only difference is, that it is now automagically built-in.




was (Author: jensg):
The problem fixed in Delphi was, that an unexpected and uncaught exception thrown in the code could terminate the currently active connection. The fix ensures that any uncaught exceptions are catched and converted into an generic {{TApplication}} exception, and especially that the existing connection stays alive. 

If Ruby has a similar problem we will happily review any patch proposal that you might have. The workaround is to add proper exception handling to all service handler entry points like this (pseudo code):

{code} 
function MyServiceImpl.Foobarize() {
    try {
        // ... some funky cool stuff here ...   
    }
    catch(Exception e) {
        throw new TApplicationException( e.message);
    }
}
{code} 

That's essentially what the patch does.



> Limited use Thrift::ApplicationException in Ruby
> ------------------------------------------------
>
>                 Key: THRIFT-2908
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2908
>             Project: Thrift
>          Issue Type: Bug
>          Components: Ruby - Library
>    Affects Versions: 0.9.2
>            Reporter: Adam Hawkins
>
> I'm implementing a bunch of Thrift servers in Ruby. I'm trying to figure out how to use {{Thrift::ApplicationException}} for error handling. I came across a link on stack overflow [http://stackoverflow.com/questions/27312244/general-error-handling-in-apache-thrift] that documents exactly what I'm trying to do but applied to the delphi library. The fix (THRIFT-2860) has been merged and set for 0.9.3 release. I'm investigating the generated ruby code and it seems {{Thrift::ApplicationException}} is only used in the clients, and never mentioned in any of the server or processor code. Is it possible to implement a similar fix for ruby severs, or should I define a generic exception and have all RPC's throw that as a work around?



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