I'm designing an error page for a particular exception type.
<error-page>
<exception-type>xxx.AbstractConfigurableNotFoundException</exception-type>
<location>/xxx/page-not-found.xhtml</location>
</error-page>
I am using OmniFaces and their exception factory to handle errors.
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandler</exception-handler-factory>
</factory>
AbstractConfigurable
is a domain class and its instance is being created during template evaluation*. The constructor of AbstractConfigurable
may throw an AbstractConfigurableNotFoundException
. When it does, this exception gets wrapped into template-specific exceptions as a cause.
javax.servlet.ServletException
Caused by: javax.faces.view.facelets.TagAttributeException
Caused by: com.sun.faces.mgbean.ManagedBeanCreationException
...
Caused by: xxx.AbstractConfigurableNotFoundException
As a result, a different exception type comes out and my <error-page>
logic isn't applied.
Obviously, I don't want to handle, javax.faces.view.facelets.TagAttributeException
<error-page>
<exception-type>javax.faces.view.facelets.TagAttributeException</exception-type>
<location>/xxx/page-not-found.xhtml</location>
</error-page>
but I'd like to handle any exception with an AbstractConfigurableNotFoundException
as a cause.
Is there anything I can do about it?