Interface TemplateExceptionHandler

    • Method Detail

      • handleTemplateException

        void handleTemplateException​(TemplateException te,
                                     Environment env,
                                     Writer out)
                              throws TemplateException
        Method called after a TemplateException was raised inside a template. The error is logged before this is called, so there's no need to log it here. 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 handle this exception and roll back the output generated inside it.

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

        Parameters:
        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
        Throws:
        TemplateException