Loading...

velocity-user@jakarta.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Swallowed Exceptions Mike Rettig Mon Jul 19 21:28:40 2004

In my velocity template, I have a method that is throwing a
RuntimeException. Unfortunately, it appears the exception in caught,
logged and ignored. This is problematic because I need to be notified
of the exception so I can handle it accordingly.


VMProxyArg.java

       catch( MethodInvocationException mie )
        {
            /*
             *  not ideal, but otherwise we propogate out to the 
             *  VMContext, and the Context interface's put/get 
             *  don't throw. So this is a the best compromise
             *  I can think of
             */
            
            rsvc.error("VMProxyArg.getObject() : method invocation
error getting value : " + mie );
            
            return null;
        }

Can this behavior be fixed? I'm using Velocity to create emails, so I
don't want to send the email if there is any type of exception during
the template merging.

Is there any workaround? I could listen to the LogSystem for errors,
then not send the email if there is an error, but that is not ideal.

Thanks for any help,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]