com.google.template.soy.base
Class SoySyntaxException

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

public class SoySyntaxException
extends RuntimeException

Exception for Soy syntax errors.

Important: Users outside of Soy code may call the getters on a SoySyntaxException object created by the Soy compiler, but should not create or mutate SoySyntaxException objects themselves (treat constructors, creation functions, and mutating methods as superpackage-private).

See Also:
Serialized Form

Constructor Summary
  SoySyntaxException(String message)
          Deprecated. Do not use outside of Soy code (treat as superpackage-private).
protected SoySyntaxException(String message, Throwable cause)
           Important: Do not use outside of Soy code (treat as superpackage-private).
protected SoySyntaxException(Throwable cause)
           Important: Do not use outside of Soy code (treat as superpackage-private).
 
Method Summary
 SoySyntaxException associateMetaInfo(com.google.template.soy.base.SourceLocation srcLoc, String filePath, String templateName)
           Important: Do not use outside of Soy code (treat as superpackage-private).
static SoySyntaxException createCausedWithMetaInfo(String message, Throwable cause, com.google.template.soy.base.SourceLocation srcLoc, String filePath, String templateName)
           Important: Do not use outside of Soy code (treat as superpackage-private).
static SoySyntaxException createCausedWithoutMetaInfo(String message, Throwable cause)
           Important: Do not use outside of Soy code (treat as superpackage-private).
static SoySyntaxException createWithMetaInfo(String message, com.google.template.soy.base.SourceLocation srcLoc, String filePath, String templateName)
           Important: Do not use outside of Soy code (treat as superpackage-private).
static SoySyntaxException createWithoutMetaInfo(String message)
           Important: Do not use outside of Soy code (treat as superpackage-private).
 String getMessage()
           
 String getOriginalMessage()
           
 com.google.template.soy.base.SourceLocation getSourceLocation()
          The source location at which the error occurred or SourceLocation.UNKNOWN.
 String getTemplateName()
          The name of the template in which the problem occurred or null if not known.
 
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

SoySyntaxException

@Deprecated
public SoySyntaxException(String message)
Deprecated. Do not use outside of Soy code (treat as superpackage-private).

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
message - A detailed description of what the syntax error is.

SoySyntaxException

protected SoySyntaxException(String message,
                             Throwable cause)

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
message - A detailed description of what the syntax error is.
cause - The Throwable underlying this syntax error.

SoySyntaxException

protected SoySyntaxException(Throwable cause)

Important: Do not use outside of Soy code (treat as superpackage-private).

Note: For this constructor, the message will be set to the cause's message.

Parameters:
cause - The Throwable underlying this syntax error.
Method Detail

createWithoutMetaInfo

public static SoySyntaxException createWithoutMetaInfo(String message)

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
message - The error message.
Returns:
The new SoySyntaxException object.

createCausedWithoutMetaInfo

public static SoySyntaxException createCausedWithoutMetaInfo(@Nullable
                                                             String message,
                                                             Throwable cause)

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
message - The error message, or null to use the message from the cause.
cause - The cause of this exception.
Returns:
The new SoySyntaxException object.

createWithMetaInfo

public static SoySyntaxException createWithMetaInfo(String message,
                                                    @Nullable
                                                    com.google.template.soy.base.SourceLocation srcLoc,
                                                    @Nullable
                                                    String filePath,
                                                    @Nullable
                                                    String templateName)

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
message - The error message.
srcLoc - The source location of the error, or null if unknown. At most one of srcLoc and filePath may be nonnull (prefer srcLoc since it contains more info).
filePath - The file path of the file containing the error. At most one of srcLoc and filePath may be nonnull (prefer srcLoc since it contains more info).
templateName - The name of the template containing the error, or null if not available.
Returns:
The new SoySyntaxException object.

createCausedWithMetaInfo

public static SoySyntaxException createCausedWithMetaInfo(@Nullable
                                                          String message,
                                                          Throwable cause,
                                                          @Nullable
                                                          com.google.template.soy.base.SourceLocation srcLoc,
                                                          @Nullable
                                                          String filePath,
                                                          @Nullable
                                                          String templateName)

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
message - The error message, or null to use the message from the cause.
cause - The cause of this exception.
srcLoc - The source location of the error, or null if unknown. At most one of srcLoc and filePath may be nonnull (prefer srcLoc since it contains more info).
filePath - The file path of the file containing the error. At most one of srcLoc and filePath may be nonnull (prefer srcLoc since it contains more info).
templateName - The name of the template containing the error, or null if not available.
Returns:
The new SoySyntaxException object.

associateMetaInfo

public SoySyntaxException associateMetaInfo(@Nullable
                                            com.google.template.soy.base.SourceLocation srcLoc,
                                            @Nullable
                                            String filePath,
                                            @Nullable
                                            String templateName)

Important: Do not use outside of Soy code (treat as superpackage-private).

Parameters:
srcLoc - The source location of the error, or null if unknown. At most one of srcLoc and filePath may be nonnull (prefer srcLoc since it contains more info).
filePath - The file path of the file containing the error. At most one of srcLoc and filePath may be nonnull (prefer srcLoc since it contains more info).
templateName - The name of the template containing the error, or null if not available.
Returns:
This same SoySyntaxException object, for convenience.

getSourceLocation

public com.google.template.soy.base.SourceLocation getSourceLocation()
The source location at which the error occurred or SourceLocation.UNKNOWN.


getTemplateName

@Nullable
public String getTemplateName()
The name of the template in which the problem occurred or null if not known.


getMessage

public String getMessage()
Overrides:
getMessage in class Throwable

getOriginalMessage

public String getOriginalMessage()
Returns:
The original error message from the Soy compiler without any metadata about the location where the error appears.