Package freemarker.template
Interface TemplateExceptionHandler
public interface TemplateExceptionHandler
An API for objects that handle exceptions that are thrown during
template rendering.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TemplateExceptionHandlerThis is a TemplateExceptionHandler used when you develop the templates.static final TemplateExceptionHandlerThis is a TemplateExceptionHandler used when you develop HTML templates.static final TemplateExceptionHandlerThis is a TemplateExceptionHandler which simply skips errors.static final TemplateExceptionHandlerThis is a TemplateExceptionHandler that simply rethrows the exception. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleTemplateException(TemplateException te, Environment env, Writer out) handle the exception.
-
Field Details
-
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
This is a TemplateExceptionHandler that simply rethrows the exception. Note that the exception is logged before being rethrown. -
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
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.
-
-
Method Details
-
handleTemplateException
void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException handle the exception.- Parameters:
te- the exception that occurred.env- The environment object that represents the rendering contextout- the character output stream to output to.- Throws:
TemplateException
-