What is TApplicationException intended to be used for?

Is there a mechanism in thrift to propagate a runtime exception from the server 
back to the client?

How do others deal with a case where the caller has made an RPC call with an 
invalid argument.  In Java I'd normally throw a IllegalArgumentException, is 
something like this possible in thrift or do I have to add another user defined 
exception type which will result in the caller having to deal with another 
checked exception.


Thanks for any help
Steve


On 05/10/2012 05:06 PM, Craig Artley wrote:


Hello, I want to take exceptions on the server and return them back to the 
client. For example, say the client's request leads to a run time exception 
like IllegalArgumentException. I think that TApplicationException with 
INTERNAL_ERROR is the way to do this, but I couldn't get it to work and I can't 
find any examples.

In my service handler, I check the args.  If they are invalid, I threw a 
TApplicationException like this
  throw new TApplicationException(TApplicationException.INTERNAL_ERROR,"Illegal 
argument blah blah");

It still showed up in my client as a TTransportException:
org.apache.thrift.transport.TTransportException
    at 
org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)

I'm sure I am just misunderstanding something.  What am I missing? Can anyone 
provide an example of robust exception handling in the server to the client?

I read about it in THRIFT-378
https://issues.apache.org/jira/browse/THRIFT-378

Regards,
  -craig

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are 
not the intended recipient (or authorized to receive information for the 
intended recipient), please contact the sender by reply e-mail and delete all 
copies of this message.

Reply via email to