thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Artley <cart...@hotmail.com>
Subject Using TApplicationException - need example
Date Thu, 10 May 2012 23:06:20 GMT

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
 		 	   		  
Mime
View raw message