com.google.template.soy.data
Class SoyDataException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.google.template.soy.data.SoyDataException
All Implemented Interfaces:
Serializable

public class SoyDataException
extends RuntimeException

Exception thrown when an error occurs in the data package.

See Also:
Serialized Form

Constructor Summary
SoyDataException(String message)
           
SoyDataException(String dataPath, String message)
           
SoyDataException(String dataPath, String message, Throwable cause)
           
SoyDataException(String message, Throwable cause)
           
 
Method Summary
 String getMessage()
           
 void prependIndexToDataPath(int index)
          Prepends an index to the data path where this error occurred.
 void prependKeyToDataPath(String key)
          Prepends a key to the data path where this error occurred.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SoyDataException

public SoyDataException(String message)
Parameters:
message - A detailed description of the error.

SoyDataException

public SoyDataException(String dataPath,
                        String message)
Parameters:
dataPath - The data path where the error occurred.
message - A detailed description of the error.

SoyDataException

public SoyDataException(String message,
                        Throwable cause)
Parameters:
message - A detailed description of the error.
cause - The throwable that is causing this exception.

SoyDataException

public SoyDataException(String dataPath,
                        String message,
                        Throwable cause)
Parameters:
dataPath - The data path where the error occurred.
message - A detailed description of the error.
cause - The throwable that is causing this exception.
Method Detail

prependKeyToDataPath

public void prependKeyToDataPath(String key)
Prepends a key to the data path where this error occurred. E.g. if the dataPath was previously 'foo.goo' and the key to prepend is 'boo', then the new data path will be 'boo.foo.goo'.

Parameters:
key - The key to prepend.

prependIndexToDataPath

public void prependIndexToDataPath(int index)
Prepends an index to the data path where this error occurred. E.g. if the dataPath was previously 'foo.goo' and the index to prepend is 2, then the new data path will be '[2].foo.goo'.

Parameters:
index - The index to prepend.

getMessage

public String getMessage()
Overrides:
getMessage in class Throwable