freemarker.template
Class TemplateException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by freemarker.template.TemplateException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Configurable.UnknownSettingException, InvalidReferenceException, NonBooleanException, NonDateException, NonNumericalException, NonStringException, StopException, TemplateModelException

public class TemplateException
extends java.lang.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 $
See Also:
Serialized Form

Constructor Summary
TemplateException(Environment env)
          Constructs a TemplateException with no specified detail message or underlying cause.
TemplateException(java.lang.Exception cause, Environment env)
          Constructs a TemplateException with the given underlying Exception, but no detail message.
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)
          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
 java.lang.Throwable getCause()
          Returns the same exception as getCauseException.
 java.lang.Exception getCauseException()
          Returns the underlying exception that caused this exception to be generated.
 Environment getEnvironment()
           
 java.lang.String getFTLInstructionStack()
          Returns the quote of the problematic FTL instruction and the FTL stack strace.
 void printStackTrace(java.io.PrintStream ps)
           
 void printStackTrace(java.io.PrintWriter pw)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateException

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


TemplateException

public TemplateException(java.lang.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(java.lang.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(java.lang.String description,
                         java.lang.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
Method Detail

getCauseException

public java.lang.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

getCause

public java.lang.Throwable getCause()
Returns the same exception as getCauseException. Provided to enable full JDK-generated stack traces when running under JDK 1.4.

Overrides:
getCause in class java.lang.Throwable
Returns:
the underlying Exception, if any, that caused this exception to be raised
See Also:
Throwable.getCause()

getFTLInstructionStack

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


getEnvironment

public Environment getEnvironment()
Returns:
the execution environment in which the exception occurred. null if the exception was deserialized.

printStackTrace

public void printStackTrace(java.io.PrintStream ps)
Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintWriter pw)
Overrides:
printStackTrace in class java.lang.Throwable