freemarker.template
Interface TemplateExceptionHandler
public interface TemplateExceptionHandler
An API for objects that handle exceptions that are thrown during
template rendering.
DEBUG_HANDLER
public static final TemplateExceptionHandler DEBUG_HANDLER
This is a TemplateExceptionHandler used when you develop the templates. This handler
outputs the stack trace information to the client and then rethrows the exception.
HTML_DEBUG_HANDLER
public static final TemplateExceptionHandler HTML_DEBUG_HANDLER
This is a TemplateExceptionHandler used when you develop HTML templates. This handler
outputs the stack trace information to the client and then rethrows the exception, and
surrounds it with tags to make the error message readable with the browser.
IGNORE_HANDLER
public static final TemplateExceptionHandler IGNORE_HANDLER
This is a TemplateExceptionHandler which simply skips errors. It does nothing
to handle the event. Note that the exception is still logged in any case, before
being passed to the handler.
RETHROW_HANDLER
public static final TemplateExceptionHandler RETHROW_HANDLER
This is a TemplateExceptionHandler that simply rethrows the exception.
Note that the exception is logged before being rethrown.
handleTemplateException
public void handleTemplateException(TemplateException te,
Environment env,
Writer out)
throws TemplateException
handle the exception.
te
- the exception that occurred.env
- The environment object that represents the rendering contextout
- the character output stream to output to.