Hi Guys,

I need some help related to exception handling. I am working on project
where i should show the meaning full messages, when there is an exception.
For example: typo in API

If there is typo in API , i need to send back the error xml with a status
message.
status code: 404
<error><errormessage>Not Found. etc</errormessage>
</error>

For this i am implementing the ExceptionMapper interface, 

public Response toResponse(final Exception e) {
       status = Status.NOT_FOUND;
       if (e instanceof WebApplicationException) {
            final WebApplicationException we = (WebApplicationException) e;
            status = Status.fromStatusCode(we.getResponse().getStatus());
        }
 
        ResponseBuilder builder = Response.status(status);
        final Error error = new Error("Here goes the message");
        return builder.entity(error).build();

// Response resp = Response.status(Response.Status.NOT_FOUND).build();

}

But, my app is still giving 500 in all the cases?

Any help?

--
View this message in context: 
http://cxf.547215.n5.nabble.com/ExceptionMapper-question-handling-exceptions-tp4463312p4463312.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to