Package freemarker.template
Class TemplateException
java.lang.Object
java.lang.Throwable
java.lang.Exception
freemarker.template.TemplateException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Configurable.UnknownSettingException,InvalidReferenceException,StopException,TemplateModelException
The FreeMarker classes usually use this exception and its descendants to
signal FreeMarker specific exceptions.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TemplateException with no specified detail message or underlying cause.TemplateException(Exception cause, Environment env) Constructs a TemplateException with the given underlying Exception, but no detail message.TemplateException(String description, Environment env) Constructs a TemplateException with the given detail message, but no underlying cause exception.TemplateException(String description, Exception cause, Environment env) Constructs a TemplateException with both a description of the error that occurred and the underlying Exception that caused this exception to be raised. -
Method Summary
Modifier and TypeMethodDescriptionReturns the underlying exception that caused this exception to be generated.Returns the quote of the problematic FTL instruction and the FTL stack strace.List<freemarker.core.parser.TemplateLocation>voidvoidMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TemplateException
Constructs a TemplateException with no specified detail message or underlying cause. -
TemplateException
Constructs a TemplateException with the given detail message, but no underlying cause exception.- Parameters:
description- the description of the error that occurred
-
TemplateException
Constructs a TemplateException with the given underlying Exception, but no detail message.- Parameters:
cause- the underlyingExceptionthat caused this exception to be raised
-
TemplateException
Constructs a TemplateException with both a description of the error that occurred and the underlying Exception that caused this exception to be raised.- Parameters:
description- the description of the error that occurredcause- the underlyingExceptionthat caused this exception to be raised
-
-
Method Details
-
getCauseException
Returns the underlying exception that caused this exception to be generated.
Note:
avoided calling itgetCauseto avoid name clash with JDK 1.4 method. This would be problematic because the JDK 1.4 method returns aThrowablerather than anException.- Returns:
- the underlying
Exception, if any, that caused this exception to be raised
-
getFTLInstructionStack
Returns the quote of the problematic FTL instruction and the FTL stack strace. As of FreeMarker 2.4, we provide access to the FTL instruction stack so you might prefer to use getFTLStack() and format the items in list yourself.- See Also:
-
getFTLStack
- Returns:
- the FTL call stack (starting with current element)
-
getEnvironment
- Returns:
- the execution environment in which the exception occurred
-
printStackTrace
- Overrides:
printStackTracein classThrowable
-
printStackTrace
- Overrides:
printStackTracein classThrowable
-