We have a restlet server and client. We need to pass the error status and exception traces back to the client so that the client can take appropriate actions depending on the error status code. I read about StatusService and using response.setStatus() method but I can’t get the specific exceptions thrown during server side processing be displayed on client side. The DAO layer from the server throws specific DB related exceptions and status code such as (Unique key violation etc), which the client needs to see and take appropriate actions.
Also, what is the common way of doing this to have centralized error handling / processing on server and client side ? Filters ?
A brief example will really help.
Thanks,
Deep
You can only send HTTP status codes and optionally your own description message. You can also send a representation of the error by overriding the getRepresentation in the StatusService.
You can return a representation of the error in getRepresentation in whatever format (XML, JSON, HTML) you want.