Interface TemplateExceptionHandler


public interface TemplateExceptionHandler
An API for objects that handle exceptions that are thrown during template rendering.
  • Field Details

    • 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 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 context
      out - the character output stream to output to.
      Throws:
      TemplateException