Hello,
Patrizio Munzi a écrit :
> I'm trying to make work the following simple exception handling.
> I just want to return the status specified.
> The problem is that client side I cannot retrieve nothing, neither the
> exception or the exception message.
>
> I'm surely doing it wrongly, but I haven't find any written explanation on
> how managing exception.
>
> Could someone give me some hints to the right way???
I think you can do the following in your catch block :
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e);
If it is not enough, try to extend StatusService class. More info in
this thread
http://restlet.markmail.org/message/ptesti33kkk5bksv?q=StatusService
Hope it help.
Regards,
Laurent.
>
> Thanks
>
> ---------------
> @Post
> public void createUser(Representation entity) {
> try {
> // Parse the given representation and retrieve pairs of
> // "name=value" tokens.
> Form form = new Form(entity);
> String userId=form.getFirstValue("userId");
>
> myApplication.createUser(userId);
>
> setStatus(Status.SUCCESS_CREATED, "Created User: " + userId);
> } catch(Throwable e) {
>
> e.printStackTrace();
> setStatus(Status.SERVER_ERROR_INTERNAL, e, e.getMessage());
>
> }
> }
--
Laurent Rustuel,
Alten contractor for Alcatel-Lucent, Brest
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2381318