PDA

View Full Version : How to catch Velocity errors?


rlebel
Sep 24th, 2004, 05:51 PM
Hello,
While processing a template, if Velocity cannot resolve the view for a #include or #parse it throws a ResourceNotFoundException that cascades into a javax.servlet.ServletException. Is there any way to trap this error? The SimpleMappingExceptionResolver does not seem to be able to catch it.

Thanks

davison
Sep 25th, 2004, 08:52 PM
ExceptionResolver is not consulted after view rendering begins. I don't think there's much you can do at this late stage - it's really a programming error. Unless you're expecting users to nominate template includes as part of normal application usage??

The only place you can even trap this error is in a HandlerInterceptor's afterCompletion() method which fires after view rendering with or without exceptions being thrown. But it's way too late to do anything like issue a response.sendRedirect.