You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Borja Martín <bo...@dagi3d.net> on 2005/01/23 16:57:34 UTC

catch exceptions thrown from templates

hi,
I would like to know if it's possible to catch the exceptions that are 
thrown from the template during the merging process. I know that 
whenever an exception takes place, a MethodInvocationException is 
thrown, but I would like to catch the exact exception that produced it, 
or at least to know which was(like java.lang.IndexOutOfBoundsException 
for example), so I can show a message easier to understand to the user 
that is working with the application.

thanks in advance.

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: catch exceptions thrown from templates

Posted by Shinobu Kawai Yoshida <sh...@gmail.com>.
Hi Borja,

> I would like to know if it's possible to catch the exceptions that are
> thrown from the template during the merging process. I know that
> whenever an exception takes place, a MethodInvocationException is
> thrown, but I would like to catch the exact exception that produced it,
> or at least to know which was(like java.lang.IndexOutOfBoundsException
> for example), so I can show a message easier to understand to the user
> that is working with the application.

You can use the event cartridge.
   http://jakarta.apache.org/velocity/developer-guide.html#EventCartridge%20and%20Event%20Handlers

Best regards,
-- Shinobu

--
Shinobu "Kawai" Yoshida <sh...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org