AJAX Exception Handling

B

bearsfoot

Hi,

I hope this is the correct group.

How should a HttpServlet include custom errors in in AJAX response.

I need to be able to control some client side behaviour based on the
error returned.

I have tried using cuctom status codes in the
HttpServletResponse.setStatus() and sendError() methods but I always
receieve a Status 500 such as in response below.
If an exception is thrown by the servlet a Status 500 is also
returned.

Thanks in advance.

===========================================
responseText = Error 500: null ErrorMessage
Error 500: Server caught unhandled exception from servlet
[testServlet]: ERROR: Cannot set header. Response
already committed.
responseXML.xml =
status = 500
statusText = Internal Server Error
=============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top