I already have the following declared in my pages.xml :
<exception>
<http-error error-code="500" />
</exception>
and this in my web.xml :
<error-page>
<error-code>500</error-code>
<location>/error500.html</location>
</error-page>
Still, sometimes when an exception is thrown I get the debug page, even when in production. I read here that when an exception is thrown during the RENDER_RESPONSE phase, no redirect can occur since the response is already being sent. I have two questions :
- How do I determine if the exception was thrown during this phase?
- Is is possible to display a custom error page no matter where the exception is thrown? If so, how can I acomplish that?
If you get the debug page in production, it means you have not correctly set debug to false.
If you are using facelets, you have to also remember to set facelets debug to false.
As well as
Now
Init.instance().isDebug()should result infalseTo get every exception defaulted to an error page, write this in pages.xml