public class TemplateException
extends java.lang.Exception
ParseException
).
It prints a special stack trace that contains the template-language stack trace along the usual Java stack trace.Modifier | Constructor and Description |
---|---|
|
TemplateException(Environment env)
Constructs a TemplateException with no specified detail message
or underlying cause.
|
|
TemplateException(java.lang.Exception cause,
Environment env)
The same as
TemplateException(Throwable, Environment) ; it's exists only for binary
backward-compatibility. |
|
TemplateException(java.lang.String description,
Environment env)
Constructs a TemplateException with the given detail message,
but no underlying cause exception.
|
|
TemplateException(java.lang.String description,
java.lang.Exception cause,
Environment env)
The same as
TemplateException(String, Throwable, Environment) ; it's exists only for binary
backward-compatibility. |
|
TemplateException(java.lang.String description,
java.lang.Throwable 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.
|
protected |
TemplateException(java.lang.Throwable cause,
Environment env,
freemarker.core._ErrorDescriptionBuilder descriptionBuilder,
boolean preventAmbiguity)
Don't use this; this is to be used internally by FreeMarker.
|
|
TemplateException(java.lang.Throwable cause,
Environment env)
Constructs a TemplateException with the given underlying Exception,
but no detail message.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getCause()
Returns the cause exception.
|
java.lang.Exception |
getCauseException()
Deprecated.
Use
getCause() instead, as this can't return runtime exceptions and errors as is. |
Environment |
getEnvironment() |
java.lang.String |
getFTLInstructionStack()
Returns the snapshot of the FTL stack strace at the time this exception was created.
|
java.lang.String |
getMessage() |
java.lang.String |
getMessageWithoutStackTop()
Similar to
getMessage() , but it doesn't contain the position of the failing instruction at then end
of the text. |
void |
printStackTrace(java.io.PrintStream out)
Overrides
Throwable.printStackTrace(PrintStream) so that it will include the FTL stack trace. |
void |
printStackTrace(java.io.PrintStream out,
boolean heading,
boolean ftlStackTrace,
boolean javaStackTrace) |
void |
printStackTrace(java.io.PrintWriter out)
Overrides
Throwable.printStackTrace(PrintWriter) so that it will include the FTL stack trace. |
void |
printStackTrace(java.io.PrintWriter out,
boolean heading,
boolean ftlStackTrace,
boolean javaStackTrace) |
void |
printStandardStackTrace(java.io.PrintStream ps)
Prints the stack trace as if wasn't overridden by
TemplateException . |
void |
printStandardStackTrace(java.io.PrintWriter pw)
Prints the stack trace as if wasn't overridden by
TemplateException . |
public TemplateException(Environment env)
public TemplateException(java.lang.String description, Environment env)
description
- the description of the error that occurredpublic TemplateException(java.lang.Exception cause, Environment env)
TemplateException(Throwable, Environment)
; it's exists only for binary
backward-compatibility.public TemplateException(java.lang.Throwable cause, Environment env)
cause
- the underlying Exception
that caused this
exception to be raisedpublic TemplateException(java.lang.String description, java.lang.Exception cause, Environment env)
TemplateException(String, Throwable, Environment)
; it's exists only for binary
backward-compatibility.public TemplateException(java.lang.String description, java.lang.Throwable cause, Environment env)
description
- the description of the error that occurredcause
- the underlying Exception
that caused this exception to be raisedprotected TemplateException(java.lang.Throwable cause, Environment env, freemarker.core._ErrorDescriptionBuilder descriptionBuilder, boolean preventAmbiguity)
preventAmbiguity
- its value is ignored; it's only to prevent constructor selection ambiguities for
backward-compatibilitypublic java.lang.Exception getCauseException()
getCause()
instead, as this can't return runtime exceptions and errors as is.Returns the underlying exception that caused this exception to be generated.
Note:
avoided calling it getCause
to avoid name clash with
JDK 1.4 method. This would be problematic because the JDK 1.4 method
returns a Throwable
rather than an Exception
.
Exception
, if any, that caused this
exception to be raisedpublic java.lang.Throwable getCause()
getCause
in class java.lang.Throwable
Exception
, if any, that caused this
exception to be raisedThrowable.getCause()
public java.lang.String getFTLInstructionStack()
public Environment getEnvironment()
null
if the exception was deserialized.public void printStackTrace(java.io.PrintStream out)
Throwable.printStackTrace(PrintStream)
so that it will include the FTL stack trace.printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintWriter out)
Throwable.printStackTrace(PrintWriter)
so that it will include the FTL stack trace.printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintWriter out, boolean heading, boolean ftlStackTrace, boolean javaStackTrace)
heading
- should the heading at the top be printedftlStackTrace
- should the FTL stack trace be printedjavaStackTrace
- should the Java stack trace be printedpublic void printStackTrace(java.io.PrintStream out, boolean heading, boolean ftlStackTrace, boolean javaStackTrace)
heading
- should the heading at the top be printedftlStackTrace
- should the FTL stack trace be printedjavaStackTrace
- should the Java stack trace be printedpublic void printStandardStackTrace(java.io.PrintStream ps)
TemplateException
.public void printStandardStackTrace(java.io.PrintWriter pw)
TemplateException
.public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public java.lang.String getMessageWithoutStackTop()
getMessage()
, but it doesn't contain the position of the failing instruction at then end
of the text. It might contains the position of the failing expression though as part of the expression
quotation, as that's the part of the description.