Package org.craftercms.engine.freemarker
Class CrafterTemplateExceptionHandler
- java.lang.Object
-
- org.craftercms.engine.freemarker.CrafterTemplateExceptionHandler
-
- All Implemented Interfaces:
freemarker.template.TemplateExceptionHandler
public class CrafterTemplateExceptionHandler extends Object implements freemarker.template.TemplateExceptionHandler
TemplateExceptionHandler
that instead of printing the errors directly in the HTML and stopping template processing, stores them in a model variable so they can be displayed later.- Author:
- Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description static String
ERROR_FORMAT
static String
FREEMARKER_CURRENT_ERROR_ID_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description CrafterTemplateExceptionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createErrorId()
protected String
getExceptionStackTrace(freemarker.template.TemplateException te)
void
handleTemplateException(freemarker.template.TemplateException te, freemarker.core.Environment env, Writer out)
void
setDisplayTemplateExceptionsInView(boolean displayTemplateExceptionsInView)
-
-
-
Field Detail
-
FREEMARKER_CURRENT_ERROR_ID_ATTRIBUTE
public static final String FREEMARKER_CURRENT_ERROR_ID_ATTRIBUTE
- See Also:
- Constant Field Values
-
ERROR_FORMAT
public static final String ERROR_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDisplayTemplateExceptionsInView
public void setDisplayTemplateExceptionsInView(boolean displayTemplateExceptionsInView)
-
handleTemplateException
public void handleTemplateException(freemarker.template.TemplateException te, freemarker.core.Environment env, Writer out) throws freemarker.template.TemplateException
- Specified by:
handleTemplateException
in interfacefreemarker.template.TemplateExceptionHandler
- Throws:
freemarker.template.TemplateException
-
getExceptionStackTrace
protected String getExceptionStackTrace(freemarker.template.TemplateException te)
-
createErrorId
protected String createErrorId()
-
-