I wonder if the distinction of TemplateModelException from
TemplateException (where TemplateModelExceltion extends
TemplateException) has any real benefits. Because it surely has real
problems. It's that whenever you call something from a TemplateModel
implementation that can throw TemplateException, you have to wrap it
into a TemplateModelException (and then whoever will catch it, might
need to add logic to unwrap it). This occurs quite often with
TemplateDirecticeModel-s and TemplateMethodModel-s in FM2, that's why
the execute method in the new TemplateDirecticeModel in FM3 and
TemplateFunctionModel allows throwing TemplateException, not just
TemplateModelException. But the same problem can occur with
TemplateHashModel.get as well (if you need to access FreeMarker
facilities from there), and really with any of the model interfaces.

So I would like to allow all TemplateModel methods to throw
TemplateException, not just TemplateModelException. That would
practically make TemplateModelException unnecessary, though we may use
it for ObjectWrapping errors and rename it to ObjectWrappingException.

Anyone opposes this?

-- 
Thanks,
 Daniel Dekany

Reply via email to