Catch hibernate exceptions with errorpage handler?
- by membersound
I'm catching all exceptions within:
java.lang.Throwable
/page.xhtml
java.lang.Error
/page.xhtml
But what If I get eg a hibernate ex:
org.hibernate.exception.ConstraintViolationException
Do I have to define error-pages for EVERY maybe occuring exception? Can't I just say "catch every exception"?
Update
Redirect on a 404 works. But on a throwable does not!
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error.xhtml</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error.xhtml</location>
</error-page>