In previous versions of FreeMarker, there was an event API which allowed you to plug in different instances of TemplateEventAdapter to deal with exceptions thrown when processing a template.
This API is now gone. Currently, exceptions that occur when rendering a template simply bubble up to be handled by the calling method. There is a toggle you can set called DEBUG_MODE, that is settable via Template.setDebugMode() which allows you to simply handle the exception by having a stack trace output to the client. If this is set to false, the exception is simply thrown up to the calling method. Typically, you would set the debug mode to true during development, but then for production, you would set it to false, and then catch the exception yourself and presumably, implement some more graceful behavior, such as outputting an error page.
Previous: Model For XML | Next: Ant integration |