Package freemarker.template
Class TemplateModelException
java.lang.Object
java.lang.Throwable
java.lang.Exception
freemarker.template.TemplateException
freemarker.template.TemplateModelException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
InvalidPropertyException
ObjectWrapper-s may throw this when wrapping/unwrapping fails, or TemplateModel methods throw this
if the requested data can't be retrieved.- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs aTemplateModelExceptionwith no specified detail message.TemplateModelException(Exception cause)The same asTemplateModelException(Throwable); it's exists only for binary backward-compatibility.TemplateModelException(String description)Constructs aTemplateModelExceptionwith the specified detail message.TemplateModelException(String description, boolean replaceWithCause, Throwable cause)Constructs a TemplateModelException with both a description of the error that occurred and the underlying Exception that caused this exception to be raised.TemplateModelException(String description, Exception cause)The same asTemplateModelException(String, Throwable); it's exists only for binary backward-compatibility.TemplateModelException(String description, Throwable cause)TemplateModelException(Throwable cause)Constructs aTemplateModelExceptionwith the given underlying Exception, but no detail message.protectedTemplateModelException(Throwable cause, Environment env, freemarker.core._ErrorDescriptionBuilder descriptionBuilder, boolean preventAmbiguity)Don't use this; this is to be used internally by FreeMarker.protectedTemplateModelException(Throwable cause, Environment env, String description, boolean preventAmbiguity)Don't use this; this is to be used internally by FreeMarker. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates that the cause exception should be thrown instead of this exception; it was only wrapped into this exception due to API constraints.Methods inherited from class freemarker.template.TemplateException
getBlamedExpressionString, getCauseException, getColumnNumber, getEndColumnNumber, getEndLineNumber, getEnvironment, getFTLInstructionStack, getLineNumber, getMessage, getMessageWithoutStackTop, getTemplateName, getTemplateSourceName, printStackTrace, printStackTrace, printStackTrace, printStackTrace, printStandardStackTrace, printStandardStackTraceMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TemplateModelException
public TemplateModelException()Constructs aTemplateModelExceptionwith no specified detail message. -
TemplateModelException
Constructs aTemplateModelExceptionwith the specified detail message.- Parameters:
description- the detail message.
-
TemplateModelException
The same asTemplateModelException(Throwable); it's exists only for binary backward-compatibility. -
TemplateModelException
Constructs aTemplateModelExceptionwith the given underlying Exception, but no detail message.- Parameters:
cause- the underlyingExceptionthat caused this exception to be raised
-
TemplateModelException
The same asTemplateModelException(String, Throwable); it's exists only for binary backward-compatibility. -
TemplateModelException
-
TemplateModelException
Constructs a TemplateModelException 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 occurredreplaceWithCause- SeegetReplaceWithCause(); usuallyfalse, unless you are forced to wrapTemplateExceptioninto aTemplateModelExceptionmerely due to API constraints.cause- the underlyingExceptionthat caused this exception to be raised- Since:
- 2.3.28
-
TemplateModelException
protected TemplateModelException(Throwable cause, Environment env, String description, boolean preventAmbiguity)Don't use this; this is to be used internally by FreeMarker.- Parameters:
preventAmbiguity- its value is ignored; it's only to prevent constructor selection ambiguities for backward-compatibility
-
TemplateModelException
protected TemplateModelException(Throwable cause, Environment env, freemarker.core._ErrorDescriptionBuilder descriptionBuilder, boolean preventAmbiguity)Don't use this; this is to be used internally by FreeMarker.- Parameters:
preventAmbiguity- its value is ignored; it's only to prevent constructor selection ambiguities for backward-compatibility
-
-
Method Details
-
getReplaceWithCause
public boolean getReplaceWithCause()Indicates that the cause exception should be thrown instead of this exception; it was only wrapped into this exception due to API constraints. Such unwanted wrapping typically occurs when you are only allowed to throwTemplateModelException, but the exception to propagate is a more genericTemplateException. The error handler mechanism of FreeMarker will replace the exception with itsThrowable.getCause()when it has bubbled up to a place where that constraint doesn't apply anymore.- Since:
- 2.3.28
-