I already have the following declared in my pages.xml:
<exception>
<http-error error-code="500" />
</exception>
and this is in my web.xml:
<error-page>
<error-code>500</error-code>
<location>/error500.html</location>
</error-page>
However, sometimes when an exception is thrown, I get a debug page even when it is in production. I read here that if an exception occurs during the RENDER_RESPONSE phase, redirection cannot occur because the response has already been sent. I have two questions:
- How to determine if an exception was excluded at this stage?
- Is it possible to display a custom error page regardless of where the exception is thrown? If so, how can I do this?