Package org.mozilla.javascript.tools
Class ToolErrorReporter
java.lang.Object
org.mozilla.javascript.tools.ToolErrorReporter
- All Implemented Interfaces:
ErrorReporter
Error reporter for tools.
Currently used by both the shell and the compiler.
-
Constructor Summary
ConstructorsConstructorDescriptionToolErrorReporter
(boolean reportWarnings) ToolErrorReporter
(boolean reportWarnings, PrintStream err) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Report an error.static String
getMessage
(String messageId) Look up the message corresponding to messageId in the org.mozilla.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
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.
-
Constructor Details
-
ToolErrorReporter
public ToolErrorReporter(boolean reportWarnings) -
ToolErrorReporter
-
-
Method Details
-
getMessage
Look up the message corresponding to messageId in the org.mozilla.javascript.tools.shell.resources.Messages property file. For internationalization support. -
getMessage
-
getMessage
-
getMessage
-
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
-