Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Custom error handler not reflecting error code for 500

Avatar

Community Advisor

Hi,

I've overridden the OOTB error handler and it works fine for 404 pages.

For 500 error, I've created a Throwable.jsp and inside the calling service class which internally set the response code 500 and include the page

RequestDispatcher dispatcher = request.getRequestDispatcher(path);

response.setStatus(500);

dispatcher.include(new GetRequest(request), response);

return;

Even though I'm setting the 500 error, the page returns 200. And, also, whatever be the content of error page, it's including inside loaded page which is like, it shows headers twice. I believe that 'cos of loading page already has header and another one is coming from error page which is included inside loading page.

Could you please check?

Best regards,
Himanshu Singhal

15 Replies