Actually the patch below is only a little bit of what I want :-)

With the increasing move towards the "pull" model in Turbine, methods
invoked from templates are likely to be doing more and more real work,
so when they throw exceptions it's really important to be able to find
out what happened. Right now the exception just gets eaten, and the
reference evaluates to null. The patch below helps a bit by logging the
exception to the velocity log.

However what I'd really like is for Velocity to propogate the exception
right up to the application back out through Template.merge. That way
the application (in my case Turbine) can use its own mechanisms for
notifying the user/developer of what happened. Of course you might want
to wrap the exception in a velocity class (probably one living in
o.a.v.exception).

I realise this involves changing the signature of SimpleNode and
probably some other methods back up the call stack to merge, but it
would add huge value for me. Non of the other SimpleNode subclasses
need to change the execute signature, subclassed methods can have a
narrower throws definitions than the superclass.

Anyway the patch to add logging:

Index: ASTMethod.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java,v
retrieving revision 1.10
diff -u -r1.10 ASTMethod.java
--- ASTMethod.java      2001/01/03 05:26:27     1.10
+++ ASTMethod.java      2001/02/27 08:12:00
@@ -248,6 +248,7 @@
         }
         catch (Exception e)
         {
+            Runtime.error("ASTMethod.execute() : invocation exception : " + e );
             return null;
         }            
     }

-- 
Sean Legassick
[EMAIL PROTECTED]
      Hombre soy, nada humano me puede ser ajeno  
      
      

Reply via email to