I play with SimpleMappingExceptionResolver to see how it works and see if it will be used for the client, but I have problems understanding it.
What I tried was visiting a specific page in my application and its exception in the handleRequestInternal method.
When I throw a RecoverableDataAccessException (subclass of DataAccessException), then the correct error page is displayed, as expected.
When I throw a freemarker.core.InvalidReferenceException or java.lang.NumberFormatException, then the exception creates bubbles on the page and the 500 error page is displayed by default (i.e. not styling).
Below is the mapping I am using.
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <prop key="org.springframework.dao.DataAccessException">/general/error/500</prop> <prop key="freemarker.core.InvalidReferenceException">/general/error/500</prop> <prop key="NumberFormatException">/general/error/500</prop> </props> </property> <property name="defaultErrorView" value="/general/error/500" /> </bean>
I, at least, expected that the default error view would allow me to throw an exception and display my specific error page, but this does not happen.
Am I using SimpleMappingExceptionHandler correctly here?
[edit] I am using the pier.
[edit] I realized that SMER does not handle errors that occur during rendering, which explains why it cannot catch those that I am having problems with. Is it possible to get SMER to handle 500 style errors?
source share