velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Velocity and wrong file name
Date Mon, 26 Feb 2001 06:06:19 GMT
Ok, all is in for the addition we talked about for two new exceptions to
be thrown by Runtime.getTemplate() :
 
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException

They are nothing fancy, but help you distinguish between the two
fundamental errors when dealing with templates ( not finding them and
syntax errors) and deal with them at app level.

So the deal is, wherever you call getTemplate() you can figure out what
is going on :

try
{
  outty =  getTemplate("sample.vm");
}
catch( ParseErrorException pee )
{
}
catch( ResourceNotFoundException rnfe )
{
}
catch( Exception e )
{
  // when things get ugly internally
}

I think I got it all right.  I tested a bit (imagine...).

Will document when the docs get checked in in Anakia form.

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Developing for the web?  See http://jakarta.apache.org/velocity/

Mime
View raw message