Terminating a macro on error

Chris <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
I'm guessing there isn't an answer to this one, but thought I'd ask:

We've got a macro that looks like this:

<#macro foo>
   <#assign bar = myMethod()/>
   Render ${bar} and do other stuff.
</#macro>

myMethod() is a TemplateMethodModelEx. Sometimes it throws exceptions. I 
trap these exceptions with a simple TemplateExceptionHandler that just 
writes the error to the output.

The trouble is that the macro continues to execute after the exception 
happens. I'd prefer that it just terminate and resume rendering the page 
after the macro.

Is there some kind of magic I can do in the TemplateException handler 
that would look forward in the parse tree to the end of the macro, and 
resume execution there?



------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.