Catch hibernate exceptions with errorpage handler?
Posted
by
membersound
on Stack Overflow
See other posts from Stack Overflow
or by membersound
Published on 2012-03-25T02:18:16Z
Indexed on
2012/03/25
11:29 UTC
Read the original article
Hit count: 203
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>
© Stack Overflow or respective owner