I'm assuming your service is written in Java. To remove the stack trace information from the exception create your own Exception class and override fillInStackTrace(). Do not call super.fillInStackTrace and just return this.

What Jeff is talking about is using something like AspectJ so that you don't have to write the catch and throw code multiple times.

There is one more thing that you can do to get exceptions that make sense on the client side. RMI does this and I wish Hessian did it too. On the client side you'll still get this exception that was created on the server side and now it will have no stack trace. On the client side catch the exception and create your own new exception of the same class and with the same message but have it create a new stack trace so that the exception makes sense in the client code.

Sarel

On 11/24/2013 2:32 AM, Rick Mann wrote:
Not sure I understand.

I'm catching all exceptions in the Hessian service implementation method, and 
then throwing a simple, simplified one. But it seems that Hessian wraps that in 
something with a ton of detail. To be sure, my simplified exception resulted in 
a much smaller return payload (4k vs 24k), but it's still way too much, not to 
mention to revealing of what the server is doing.

On Nov 23, 2013, at 23:15 , Jeff Schnitzer <j...@infohazard.org> wrote:

Are you using any kind of DI framework? Apply an interceptor that catches and 
throws your stripped down exception.

Jeff

On Nov 24, 2013 6:13 AM, "Rick Mann" <rm...@latencyzero.com> wrote:
If my server-side Hessian method throws an exception, what gets sent back to my 
client is very verbose, complete with a stack trace.

Is there any way to prevent Hessian from doing this? I'd like to throw a 
simple, custom exception, and have only the data contained in that exception 
get sent back to the client; not the entire call stack that led to it.

--
Rick




_______________________________________________
hessian-interest mailing list
hessian-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/hessian-interest

_______________________________________________
hessian-interest mailing list
hessian-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/hessian-interest



_______________________________________________
hessian-interest mailing list
hessian-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/hessian-interest

_______________________________________________
hessian-interest mailing list
hessian-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to