Package org.mozilla.javascript.tools
Class ToolErrorReporter
- java.lang.Object
- 
- org.mozilla.javascript.tools.ToolErrorReporter
 
- 
- All Implemented Interfaces:
- ErrorReporter
 
 public class ToolErrorReporter extends java.lang.Object implements ErrorReporter Error reporter for tools.Currently used by both the shell and the compiler. 
- 
- 
Constructor SummaryConstructors Constructor Description ToolErrorReporter(boolean reportWarnings)ToolErrorReporter(boolean reportWarnings, java.io.PrintStream err)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderror(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)Report an error.static java.lang.StringgetMessage(java.lang.String messageId)Look up the message corresponding to messageId in the org.mozilla.javascript.tools.shell.resources.Messages property file.static java.lang.StringgetMessage(java.lang.String messageId, java.lang.Object[] args)static java.lang.StringgetMessage(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)static java.lang.StringgetMessage(java.lang.String messageId, java.lang.String argument)booleanhasReportedError()booleanisReportingWarnings()static voidreportException(ErrorReporter er, RhinoException ex)voidreportException(RhinoException ex)EvaluatorExceptionruntimeError(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)Creates an EvaluatorException that may be thrown.voidsetIsReportingWarnings(boolean reportWarnings)voidwarning(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)Report a warning.
 
- 
- 
- 
Method Detail- 
getMessagepublic static java.lang.String getMessage(java.lang.String messageId) Look up the message corresponding to messageId in the org.mozilla.javascript.tools.shell.resources.Messages property file. For internationalization support.
 - 
getMessagepublic static java.lang.String getMessage(java.lang.String messageId, java.lang.String argument)
 - 
getMessagepublic static java.lang.String getMessage(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
 - 
getMessagepublic static java.lang.String getMessage(java.lang.String messageId, java.lang.Object[] args)
 - 
warningpublic void warning(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)Description copied from interface:ErrorReporterReport a warning.The implementing class may choose to ignore the warning if it desires. - Specified by:
- warningin interface- ErrorReporter
- Parameters:
- message- a String describing the warning
- sourceName- a String describing the JavaScript source where the warning occured; typically a filename or URL
- line- the line number associated with the warning
- lineSource- the text of the line (may be null)
- lineOffset- the offset into lineSource where problem was detected
 
 - 
errorpublic void error(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)Description copied from interface:ErrorReporterReport 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:
- errorin interface- ErrorReporter
- Parameters:
- message- a String describing the error
- sourceName- a String describing the JavaScript source where the error occured; typically a filename or URL
- line- the line number associated with the error
- lineSource- the text of the line (may be null)
- lineOffset- the offset into lineSource where problem was detected
 
 - 
runtimeErrorpublic EvaluatorException runtimeError(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset) Description copied from interface:ErrorReporterCreates an EvaluatorException that may be thrown.runtimeErrors, unlike errors, will always terminate the current script. - Specified by:
- runtimeErrorin interface- ErrorReporter
- Parameters:
- message- a String describing the error
- sourceName- a String describing the JavaScript source where the error occured; typically a filename or URL
- line- the line number associated with the error
- lineSource- the text of the line (may be null)
- lineOffset- the offset into lineSource where problem was detected
- Returns:
- an EvaluatorException that will be thrown.
 
 - 
hasReportedErrorpublic boolean hasReportedError() 
 - 
isReportingWarningspublic boolean isReportingWarnings() 
 - 
setIsReportingWarningspublic void setIsReportingWarnings(boolean reportWarnings) 
 - 
reportExceptionpublic static void reportException(ErrorReporter er, RhinoException ex) 
 - 
reportExceptionpublic void reportException(RhinoException ex) 
 
- 
 
-