Package com.google.javascript.jscomp
Class JSError
java.lang.Object
com.google.javascript.jscomp.JSError
Compile error description
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringDescription of the errorfinal CheckLevelDeprecated.Use #getDefaultLevelfinal intLine number of the sourcefinal StringName of the source -
Method Summary
Modifier and TypeMethodDescriptionbooleanformat(CheckLevel level, MessageFormatter formatter) Format a message at the given level.intGet the character number.The default level, before any of the WarningsGuards are applied.intGet the line number.intintgetType()inthashCode()static JSErrormake(DiagnosticType type, String... arguments) Creates a JSError with no source informationstatic JSErrormake(Node n, DiagnosticType type, String... arguments) Creates a JSError from a file and Node position.static JSErrormake(String sourceName, int lineno, int charno, CheckLevel level, DiagnosticType type, String... arguments) Creates a JSError at a given source locationstatic JSErrormake(String sourceName, int lineno, int charno, DiagnosticType type, String... arguments) Creates a JSError at a given source locationstatic JSErrormake(String sourceName, Node n, CheckLevel level, DiagnosticType type, String... arguments) Creates a JSError from a file and Node position.static JSErrormake(String sourceName, Node n, DiagnosticType type, String... arguments) Creates a JSError from a file and Node position.toString()
-
Field Details
-
description
Description of the error -
sourceName
Name of the source -
lineNumber
public final int lineNumberLine number of the source -
level
Deprecated.Use #getDefaultLevel
-
-
Method Details
-
make
Creates a JSError with no source information- Parameters:
type- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
make
public static JSError make(String sourceName, int lineno, int charno, DiagnosticType type, 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(String sourceName, int lineno, int charno, CheckLevel level, DiagnosticType type, 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
Creates a JSError from a file and Node position.- Parameters:
sourceName- The source file namen- Determines the line and char position within the source file nametype- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
make
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(String sourceName, Node n, CheckLevel level, DiagnosticType type, String... arguments) Creates a JSError from a file and Node position.- Parameters:
sourceName- The source file namen- Determines the line and char position within the source file nametype- The DiagnosticTypearguments- Arguments to be incorporated into the message
-
getType
-
format
Format a message at the given level.- Returns:
- the formatted message or
null
-
toString
-
getCharno
public int getCharno()Get the character number. -
getLineNumber
public int getLineNumber()Get the line number. One-based. -
getNodeSourceOffset
public int getNodeSourceOffset()- Returns:
- the offset of the region the Error applies to, or -1 if the offset is unknown.
-
getNodeLength
public int getNodeLength()- Returns:
- the length of the region the Error applies to, or 0 if the length is unknown.
-
getDefaultLevel
The default level, before any of the WarningsGuards are applied. -
equals
-
hashCode
public int hashCode()
-