My conclusion from this test is that the client resource proxy mechanism, in conjunction with the built-in status service, doesn't exactly reproduce on the client side the status passed to the constructor of the ResourceException thrown on the server side. It comes close: It gets the code and reason phrase right, but it uses the reason phrase as the description on the client side.
The HTML error representation *does* include the correct description, though, so this feels like a bug. I have vague feeling there has already been some discussion of this, but the items that turn up when I search, though superficially similar, aren't quite the same thing: http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=2804582&dsForumId=4375 http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=975076&dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=91426&dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=91576&dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=2686574&dsForumId=4375 http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=11839&dsForumId=4375 --tim On Wed, Jan 25, 2012 at 10:08 AM, Tim Peierls <[email protected]> wrote: > I just modified this example to turn it into a JUnit test. > > > On Tue, Jan 24, 2012 at 11:05 PM, Tim Peierls <[email protected]> wrote: > >> I get the correct status code on the client side. Run this code: >> >> http://pastebin.com/3nzsjFi1 >> >> The description I set on the server side is not passed to the client side. >> >> --tim >> >> >> On Tue, Jan 24, 2012 at 2:00 PM, D G <[email protected]> wrote: >> >>> Thanks Tim for your response. Earlier I was using 2.0.9 and after your >>> response, I tried with 2.1-RC2. However, I see the same result :((. Code >>> in >>> the status is 507 and description = Insufficient Storage >>> In apache logs, I see >>> ************************************************* >>> Jan 25, 2012 12:16:56 AM org.restlet.resource.ServerResource doCatch >>> WARNING: Exception or error caught in server resource >>> Insufficient Storage (507) - Storage system exception >>> Here are the code snippets. >>> ************************************************* >>> >>> Server side >>> ******** >>> // I've tried with StorageSystemException extends Exception and >>> RuntimeException >>> // StatusService is not overrriden >>> catch (StorageSystemException se) { >>> throw new >>> ResourceException(Status.SERVER_ERROR_INSUFFICIENT_STORAGE, >>> "Storage system exception", new RuntimeException()); >>> >>> Client Side >>> ******** >>> ClientResource cr = new ClientResource(url); >>> MyResource myres = cr.wrap(MyResource.class); >>> int val = myres.callMethod(); >>> } >>> catch(Exception e) { >>> Status s = cr.getStatus(); >>> s.getDescription(); >>> } >>> >>> >>> >>> >>> -- >>> View this message in context: >>> http://restlet-discuss.1400322.n2.nabble.com/Sending-server-side-exceptions-error-codes-back-to-client-tp7219795p7221382.html >>> Sent from the Restlet Discuss mailing list archive at Nabble.com. >>> >>> ------------------------------------------------------ >>> >>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2910819 >>> >> >> > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2911058

