velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Velocity and wrong file name
Date Wed, 21 Feb 2001 19:39:11 GMT
Was doing a little review of this, and the problem really isn't centered
around Template.merge() - rather Runtime.getTemplate() may be where we
should focus.

getTemplate() currently returns a healthy, working Template or null,
null when it can't find the resource (file) or parse it due to syntax
error.  Now, that hides the reason (although it is logged...)

How about we create a new set of exceptions  :

org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException

to get started, and have getTemplate() throw those. That basically are
the two problem conditions that are really common and predictable with
this, and it would make the Turbiners happy. 

I am suggesting the new package o.a.v.exception, as we have a
o.a.v.runtime.exception package already, but that is for internal stuff,
and o.a.v.runtime.parser.ParserException, but again, that's internal for
the most part.

Maybe o.a.v.app.exception ?  Maybe that's better.

ideas?

I think this will fit ok into the current resource management
structure...

geir


Rafal Krzewski wrote:
> 
> "Geir Magnusson Jr." wrote:
> 
> > I guess if that was the case (lots of Velocity-specific exceptions
> > possible) , it can be handled down there in the TurbineVelocityService,
> > and just map to whatever set of exceptions turbine may use internally.
> > It's not clear that Turbine has this kind of support in that the
> > 'template engine agnostic' model may be a figment of my fevered
> > imagination.
> 
> I don't see anything wrong with catching the bunch of Velocity specific
> exceptions in VelocityService and mapping them to what ever higher-level
> behaviour is desired. Right now the policy is (or at least I think it
> is) wrapping the exception into a TurbineException and passing it to the
> application (Screen/Layout class etc). If the application doesn't handle
> it, catch-all code at the end main Turbine service method will grab it
> and try to display a '500' page.
> 
> You havbe my non-commiter +1 to fine grained exceptions in Velocity
> 
> Rafal
> 
> --
> Rafal Krzewski
> Senior Internet Developer
> mailto:Rafal.Krzewski@e-point.pl
> +48 22 8534830 http://e-point.pl

-- 
Geir Magnusson Jr.                               geirm@optonline.com

Developing for the web?  See http://jakarta.apache.org/velocity/

Mime
View raw message