Package com.google.javascript.jscomp
Class JSError
- java.lang.Object
-
- com.google.javascript.jscomp.JSError
-
- All Implemented Interfaces:
java.io.Serializable
public abstract class JSError extends java.lang.Object implements java.io.SerializableCompile error description.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Stringformat(CheckLevel level, MessageFormatter formatter)Format a message at the given level.abstract intgetCharno()Zero-indexed character number of the error location.abstract CheckLevelgetDefaultLevel()The default level, before any of theWarningsGuards are applied.abstract java.lang.StringgetDescription()Description of the error.abstract intgetLineno()One-indexed line number of the error location.intgetLineNumber()Alias forgetLineno().abstract NodegetNode()Node where the warning occurred.intgetNodeLength()intgetNodeSourceOffset()abstract java.lang.StringgetSourceName()Name of the sourceabstract DiagnosticTypegetType()A type of the error.static JSErrormake(DiagnosticType type, java.lang.String... arguments)Creates a JSError with no source informationstatic JSErrormake(Node n, CheckLevel level, DiagnosticType type, java.lang.String... arguments)Creates a JSError from a file and Node position.static JSErrormake(Node n, DiagnosticType type, java.lang.String... arguments)Creates a JSError from a file and Node position.static JSErrormake(java.lang.String sourceName, int lineno, int charno, CheckLevel level, DiagnosticType type, java.lang.String... arguments)Creates a JSError at a given source locationstatic JSErrormake(java.lang.String sourceName, int lineno, int charno, DiagnosticType type, java.lang.String... arguments)Creates a JSError at a given source locationjava.lang.StringtoString()
-
-
-
Method Detail
-
getType
public abstract DiagnosticType getType()
A type of the error.
-
getDescription
public abstract java.lang.String getDescription()
Description of the error.
-
getSourceName
@Nullable public abstract java.lang.String getSourceName()
Name of the source
-
getLineno
public abstract int getLineno()
One-indexed line number of the error location.
-
getCharno
public abstract int getCharno()
Zero-indexed character number of the error location.
-
getNode
@Nullable public abstract Node getNode()
Node where the warning occurred.
-
getDefaultLevel
public abstract CheckLevel getDefaultLevel()
The default level, before any of theWarningsGuards are applied.
-
make
public static JSError make(DiagnosticType type, java.lang.String... arguments)
Creates a JSError with no source information- Parameters:
type- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
make
public static JSError make(java.lang.String sourceName, int lineno, int charno, DiagnosticType type, java.lang.String... arguments)
Creates a JSError at a given source location- Parameters:
sourceName- The source file namelineno- Line number with source file, or -1 if unknowncharno- Column number within line, or -1 for whole line.type- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
make
public static JSError make(java.lang.String sourceName, int lineno, int charno, CheckLevel level, DiagnosticType type, java.lang.String... arguments)
Creates a JSError at a given source location- Parameters:
sourceName- The source file namelineno- Line number with source file, or -1 if unknowncharno- Column number within line, or -1 for whole line.type- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
make
public static JSError make(Node n, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.- Parameters:
n- Determines the line and char position and source file nametype- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
make
public static JSError make(Node n, CheckLevel level, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- the default rendering of an error as text.
-
format
public final java.lang.String format(CheckLevel level, MessageFormatter formatter)
Format a message at the given level.- Returns:
- the formatted message or
null
-
getNodeSourceOffset
public final int getNodeSourceOffset()
- Returns:
- the offset of the region the Error applies to, or -1 if the offset is unknown.
-
getNodeLength
public final int getNodeLength()
- Returns:
- the length of the region the Error applies to, or 0 if the length is unknown.
-
getLineNumber
public final int getLineNumber()
Alias forgetLineno().
-
-