Results 1 to 2 of 2

Thread: How to catch Velocity errors?

  1. #1
    Join Date
    Sep 2004
    Posts
    3

    Default How to catch Velocity errors?

    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

  2. #2
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    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.
    Darren Davison.
    Public Key: 0xE855B3EA

Similar Threads

  1. Replies: 4
    Last Post: Oct 26th, 2009, 08:58 AM
  2. Replies: 17
    Last Post: Jan 2nd, 2007, 01:43 PM
  3. FreeMarker vs Velocity
    By Martin Kersten in forum Architecture
    Replies: 8
    Last Post: May 30th, 2005, 09:21 AM
  4. Replies: 1
    Last Post: Apr 28th, 2005, 01:54 PM
  5. Replies: 3
    Last Post: Oct 19th, 2004, 09:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •