Interface TemplateExceptionHandler

public interface TemplateExceptionHandler
Used for the template_exception_handler configuration setting.
  • Field Details

  • Method Details

    • handleTemplateException

      void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException
      Method called after a TemplateException was raised inside a template. The exception should be re-thrown unless you want to suppress the exception.

      Note that you can check with Environment.isInAttemptBlock() if you are inside a #attempt block, which then will handle this exception and roll back the output generated inside it.

      Note that StopException-s (raised by #stop) won't be captured here.

      Note that you shouldn't log the exception in this method unless you suppress it. If there's a concern that the exception might won't be logged after it bubbles up from Template.process(Object, Writer), simply ensure that Configurable.getLogTemplateExceptions() is true.

      te - The exception that occurred; don't forget to re-throw it unless you want to suppress it
      env - The runtime environment of the template
      out - This is where the output of the template is written