Package freemarker.template
Interface TemplateExceptionHandler
-
public interface TemplateExceptionHandlerAn API for objects that handle exceptions that are thrown during template rendering.
-
-
Field Summary
Fields Modifier and Type Field Description static TemplateExceptionHandlerDEBUG_HANDLERThis is a TemplateExceptionHandler used when you develop the templates.static TemplateExceptionHandlerHTML_DEBUG_HANDLERThis is a TemplateExceptionHandler used when you develop HTML templates.static TemplateExceptionHandlerIGNORE_HANDLERThis is a TemplateExceptionHandler which simply skips errors.static TemplateExceptionHandlerRETHROW_HANDLERThis is a TemplateExceptionHandler that simply rethrows the exception.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidhandleTemplateException(TemplateException te, Environment env, Writer out)handle the exception.
-
-
-
Field Detail
-
IGNORE_HANDLER
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
static final TemplateExceptionHandler RETHROW_HANDLER
This is a TemplateExceptionHandler that simply rethrows the exception. Note that the exception is logged before being rethrown.
-
DEBUG_HANDLER
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
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.
-
-
Method Detail
-
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
-
-