users@jersey.java.net

Re: SV: [Jersey] Started work on improving Jersey's error reporting

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 26 May 2010 11:14:02 +0200

On May 26, 2010, at 10:29 AM, Morten wrote:

> --- Den ons 26/5/10 skrev Paul Sandoz <Paul.Sandoz_at_Sun.COM>:
>> Jersey used to send the exception as a response entity if
>> no entity was present.
>
> That is exactly what my error handles does. I forgot to also add the
> getFullErrorString method but that just gets the trace from the
> request.
>

> It is amazing what difference an error + a trace does to a client
> instead then just an internal server error. I just wish Jersey could
> do this automatically instead of requiring me to do a lot of work -
> especially on the Jersey client side.
>

Reusing the response entity to return the stack trace is problematic
even in a "developer mode" as it might interfere with the app. We have
found that the best thing to do is for Jersey to not interfere with
the response entity.

Modifying Jersey's UniformInterfaceException to automatically include
the response entity as the error message of the exception is not the
right thing to do as the response entity could be application specific
(and may not translate to a String).

I think we need to investigate adding an stack trace to a response
header. Then it should be possible to report something in Jersey-client.

Paul.