freemarker.template

Class TemplateException

Known Direct Subclasses:
Configurable.UnknownSettingException, InvalidReferenceException, NonBooleanException, NonNumericalException, NonStringException, StopException, TemplateModelException

public class TemplateException
extends Exception

The FreeMarker classes usually use this exception and its descendants to signal FreeMarker specific exceptions.
Version:
$Id: TemplateException.java,v 1.26.2.1 2006/02/12 20:02:15 revusky Exp $

Constructor Summary

TemplateException(Exception cause, Environment env)
Constructs a TemplateException with the given underlying Exception, but no detail message.
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.
TemplateException(String description, Environment env)
Constructs a TemplateException with the given detail message, but no underlying cause exception.
TemplateException(Environment env)
Constructs a TemplateException with no specified detail message or underlying cause.

Method Summary

Throwable
getCause()
Returns the same exception as getCauseException.
Exception
getCauseException()
Returns the underlying exception that caused this exception to be generated.
Environment
getEnvironment()
String
getFTLInstructionStack()
Returns the quote of the problematic FTL instruction and the FTL stack strace.
void
printStackTrace(PrintWriter pw)
void
printStackTrace(java.io.PrintStream ps)

Constructor Details

TemplateException

public TemplateException(Exception cause,
                         Environment env)
Constructs a TemplateException with the given underlying Exception, but no detail message.
Parameters:
cause - the underlying Exception that caused this exception to be raised

TemplateException

public 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.
Parameters:
description - the description of the error that occurred
cause - the underlying Exception that caused this exception to be raised

TemplateException

public TemplateException(String description,
                         Environment env)
Constructs a TemplateException with the given detail message, but no underlying cause exception.
Parameters:
description - the description of the error that occurred

TemplateException

public TemplateException(Environment env)
Constructs a TemplateException with no specified detail message or underlying cause.

Method Details

getCause

public Throwable getCause()
Returns the same exception as getCauseException. Provided to enable full JDK-generated stack traces when running under JDK 1.4.
Returns:
the underlying Exception, if any, that caused this exception to be raised
See Also:
Throwable.getCause()

getCauseException

public Exception getCauseException()
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.

Returns:
the underlying Exception, if any, that caused this exception to be raised

getEnvironment

public Environment getEnvironment()
Returns:
the execution environment in which the exception occurred

getFTLInstructionStack

public String getFTLInstructionStack()
Returns the quote of the problematic FTL instruction and the FTL stack strace.

printStackTrace

public void printStackTrace(PrintWriter pw)

printStackTrace

public void printStackTrace(java.io.PrintStream ps)