Class ErrorManager
java.lang.Object
com.oracle.js.parser.ErrorManager
- Direct Known Subclasses:
ErrorManager.StringBuilderErrorManager, ErrorManager.ThrowErrorManager
Handles JavaScript error reporting.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classErrorManagerthat reports to aStringBuilder.static classThrowErrorManager that throws ParserException upon error conditions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReport an error using information provided by the ParserExceptionvoidReport an error message providedstatic StringFormat an error message to include source and line information.intgetLimit()Get the message limitintGet the number of errorsintGet number of warningsbooleanTest to see if errors have occurred.booleanCheck whether warnings should be treated like errorsprotected voidReport an error or warning message.voidsetLimit(int limit) Set the message limitvoidsetWarningsAsErrors(boolean warningsAsErrors) Set warnings to be treated as errorsvoidReport a warning using information provided by the ParserExceptionvoidReport a warning message provided
-
Constructor Details
-
ErrorManager
protected ErrorManager()Constructor
-
-
Method Details
-
format
Format an error message to include source and line information.- Parameters:
message- Error message string.source- Source file information.line- Source line number.column- Source column number.token- Offending token descriptor.- Returns:
- formatted string
-
message
Report an error or warning message.- Parameters:
message- Error message string.
-
error
Report an error using information provided by the ParserException- Parameters:
e- ParserException object
-
error
Report an error message provided- Parameters:
message- Error message string.
-
warning
Report a warning using information provided by the ParserException- Parameters:
e- ParserException object
-
warning
Report a warning message provided- Parameters:
message- Error message string.
-
hasErrors
public boolean hasErrors()Test to see if errors have occurred.- Returns:
- True if errors.
-
getLimit
public int getLimit()Get the message limit- Returns:
- max number of messages
-
setLimit
public void setLimit(int limit) Set the message limit- Parameters:
limit- max number of messages
-
isWarningsAsErrors
public boolean isWarningsAsErrors()Check whether warnings should be treated like errors- Returns:
- true if warnings should be treated like errors
-
setWarningsAsErrors
public void setWarningsAsErrors(boolean warningsAsErrors) Set warnings to be treated as errors- Parameters:
warningsAsErrors- true if warnings should be treated as errors, false otherwise
-
getNumberOfErrors
public int getNumberOfErrors()Get the number of errors- Returns:
- number of errors
-
getNumberOfWarnings
public int getNumberOfWarnings()Get number of warnings- Returns:
- number of warnings
-
getParserException
-