Class MontiCoreTemplateExceptionHandler

java.lang.Object
de.monticore.generating.templateengine.freemarker.MontiCoreTemplateExceptionHandler
All Implemented Interfaces:
freemarker.template.TemplateExceptionHandler

public class MontiCoreTemplateExceptionHandler extends Object implements freemarker.template.TemplateExceptionHandler
Handles exceptions occurring during the template processing.
  • Field Details

    • LOG_AND_CONTINUE

      public static final int LOG_AND_CONTINUE
      Add an error, add a comment to the generated code and continue processing the template skipping the erroneous expression.
      See Also:
    • LOG_AND_ABORT

      public static final int LOG_AND_ABORT
      Add an error, add a comment to the generated code and abort processing the template .
      See Also:
    • CONTINUE

      public static final int CONTINUE
      Add an error and continue processing the template without adding a comment to the generated code.
      See Also:
    • ABORT

      public static final int ABORT
      Add an error and abort without adding a comment to the generated code.
      See Also:
    • THROW_ERROR

      public static final int THROW_ERROR
      Throw the error without logging it.
      See Also:
    • COMMENT_START

      protected static final String COMMENT_START
      See Also:
    • COMMENT_END

      protected static final String COMMENT_END
      See Also:
    • behavior

      protected final int behavior
      The behavior from the handler.
  • Constructor Details

    • MontiCoreTemplateExceptionHandler

      public MontiCoreTemplateExceptionHandler()
      Creates a new MontiCoreTemplateExceptionHandler with the default exception handling LOG_AND_CONTINUE.
    • MontiCoreTemplateExceptionHandler

      public MontiCoreTemplateExceptionHandler(int behavior)
      Creates a new MontiCoreTemplateExceptionHandler with the given exception handling behavior.
      Parameters:
      behavior - use one of MontiCoreTemplateExceptionHandler.LOG_AND_CONTINUE, MontiCoreTemplateExceptionHandler.LOG_AND_ABORT, MontiCoreTemplateExceptionHandler.CONTINUE or MontiCoreTemplateExceptionHandler.ABORT
  • Method Details

    • handleTemplateException

      public void handleTemplateException(freemarker.template.TemplateException te, freemarker.core.Environment env, Writer writer) throws freemarker.template.TemplateException
      Specified by:
      handleTemplateException in interface freemarker.template.TemplateExceptionHandler
      Throws:
      freemarker.template.TemplateException