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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intAdd an error and abort without adding a comment to the generated code.protected final intThe behavior from the handler.protected static final Stringprotected static final Stringstatic final intAdd an error and continue processing the template without adding a comment to the generated code.static final intAdd an error, add a comment to the generated code and abort processing the template .static final intAdd an error, add a comment to the generated code and continue processing the template skipping the erroneous expression.static final intThrow the error without logging it.Fields inherited from interface freemarker.template.TemplateExceptionHandler
DEBUG_HANDLER, HTML_DEBUG_HANDLER, IGNORE_HANDLER, RETHROW_HANDLER -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newMontiCoreTemplateExceptionHandlerwith the default exception handling LOG_AND_CONTINUE.MontiCoreTemplateExceptionHandler(int behavior) Creates a newMontiCoreTemplateExceptionHandlerwith the given exception handling behavior. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleTemplateException(freemarker.template.TemplateException te, freemarker.core.Environment env, Writer writer)
-
Field Details
-
LOG_AND_CONTINUE
public static final int LOG_AND_CONTINUEAdd 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_ABORTAdd an error, add a comment to the generated code and abort processing the template .- See Also:
-
CONTINUE
public static final int CONTINUEAdd an error and continue processing the template without adding a comment to the generated code.- See Also:
-
ABORT
public static final int ABORTAdd an error and abort without adding a comment to the generated code.- See Also:
-
THROW_ERROR
public static final int THROW_ERRORThrow the error without logging it.- See Also:
-
COMMENT_START
- See Also:
-
COMMENT_END
- See Also:
-
behavior
protected final int behaviorThe behavior from the handler.
-
-
Constructor Details
-
MontiCoreTemplateExceptionHandler
public MontiCoreTemplateExceptionHandler()Creates a newMontiCoreTemplateExceptionHandlerwith the default exception handling LOG_AND_CONTINUE. -
MontiCoreTemplateExceptionHandler
public MontiCoreTemplateExceptionHandler(int behavior) Creates a newMontiCoreTemplateExceptionHandlerwith 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:
handleTemplateExceptionin interfacefreemarker.template.TemplateExceptionHandler- Throws:
freemarker.template.TemplateException
-