users@jersey.java.net

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

From: Morten <mortench2004_at_yahoo.dk>
Date: Wed, 26 May 2010 09:31:03 +0000 (GMT)

--- Den ons 26/5/10 skrev Paul Sandoz <Paul.Sandoz_at_Sun.COM>: > 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). Sorry, I can't see the problem here. I believe all this can be put into Jersey client if you do roughly like the source code I send. Depending on which error code the server returns I have either a String with the stacktrace OR the correct entity in the response. Jersey just have to look at the status code before taking message/entity out of the response. And throwing an UniformInterfaceException does what Jersey would do anyway if I try to get my entity in case of an error + it gives a nice stack trace in JUnit if a test on the client side fails. > 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. Yes - also doable but I believe what I have shown works as-is. /Morten