Class ToolErrorReporter
java.lang.Object
org.htmlunit.corejs.javascript.tools.ToolErrorReporter
- All Implemented Interfaces:
ErrorReporter
Error reporter for tools.
Currently used by both the shell and the compiler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PrintStream
private boolean
private static final String
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionToolErrorReporter
(boolean reportWarnings) ToolErrorReporter
(boolean reportWarnings, PrintStream err) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
buildIndicator
(int offset) void
Report an error.private static String
static String
getMessage
(String messageId) Look up the message corresponding to messageId in the org.htmlunit.corejs.javascript.tools.shell.resources.Messages property file.static String
getMessage
(String messageId, Object[] args) static String
getMessage
(String messageId, Object arg1, Object arg2) static String
getMessage
(String messageId, String argument) boolean
boolean
private void
reportErrorMessage
(String message, String sourceName, int line, String lineSource, int lineOffset, boolean justWarning) static void
void
runtimeError
(String message, String sourceName, int line, String lineSource, int lineOffset) Creates an EvaluatorException that may be thrown.void
setIsReportingWarnings
(boolean reportWarnings) void
Report a warning.
-
Field Details
-
messagePrefix
- See Also:
-
hasReportedErrorFlag
private boolean hasReportedErrorFlag -
reportWarnings
private boolean reportWarnings -
err
-
-
Constructor Details
-
ToolErrorReporter
public ToolErrorReporter(boolean reportWarnings) -
ToolErrorReporter
-
-
Method Details
-
getMessage
Look up the message corresponding to messageId in the org.htmlunit.corejs.javascript.tools.shell.resources.Messages property file. For internationalization support. -
getMessage
-
getMessage
-
getMessage
-
getExceptionMessage
-
warning
Description copied from interface:ErrorReporter
Report a warning.The implementing class may choose to ignore the warning if it desires.
- Specified by:
warning
in interfaceErrorReporter
- Parameters:
message
- a String describing the warningsourceName
- a String describing the JavaScript source where the warning occured; typically a filename or URLline
- the line number associated with the warninglineSource
- the text of the line (may be null)lineOffset
- the offset into lineSource where problem was detected
-
error
Description copied from interface:ErrorReporter
Report an error.The implementing class is free to throw an exception if it desires.
If execution has not yet begun, the JavaScript engine is free to find additional errors rather than terminating the translation. It will not execute a script that had errors, however.
- Specified by:
error
in interfaceErrorReporter
- Parameters:
message
- a String describing the errorsourceName
- a String describing the JavaScript source where the error occured; typically a filename or URLline
- the line number associated with the errorlineSource
- the text of the line (may be null)lineOffset
- the offset into lineSource where problem was detected
-
runtimeError
public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) Description copied from interface:ErrorReporter
Creates an EvaluatorException that may be thrown.runtimeErrors, unlike errors, will always terminate the current script.
- Specified by:
runtimeError
in interfaceErrorReporter
- Parameters:
message
- a String describing the errorsourceName
- a String describing the JavaScript source where the error occured; typically a filename or URLline
- the line number associated with the errorlineSource
- the text of the line (may be null)lineOffset
- the offset into lineSource where problem was detected- Returns:
- an EvaluatorException that will be thrown.
-
hasReportedError
public boolean hasReportedError() -
isReportingWarnings
public boolean isReportingWarnings() -
setIsReportingWarnings
public void setIsReportingWarnings(boolean reportWarnings) -
reportException
-
reportException
-
reportErrorMessage
-
buildIndicator
-