Class ToolErrorReporter

java.lang.Object
org.mozilla.javascript.tools.ToolErrorReporter
All Implemented Interfaces:
ErrorReporter

public class ToolErrorReporter extends Object implements ErrorReporter
Error reporter for tools. Currently used by both the shell and the compiler.
  • Constructor Details

    • ToolErrorReporter

      public ToolErrorReporter(boolean reportWarnings)
    • ToolErrorReporter

      public ToolErrorReporter(boolean reportWarnings, PrintStream err)
  • Method Details

    • getMessage

      public static String getMessage(String messageId)
      Look up the message corresponding to messageId in the org.mozilla.javascript.tools.shell.resources.Messages property file. For internationalization support.
    • getMessage

      public static String getMessage(String messageId, String argument)
    • getMessage

      public static String getMessage(String messageId, Object arg1, Object arg2)
    • getMessage

      public static String getMessage(String messageId, Object[] args)
    • warning

      public void warning(String message, String sourceName, int line, String lineSource, int lineOffset)
      Description copied from interface: ErrorReporter
      Report a warning. The implementing class may choose to ignore the warning if it desires.
      Specified by:
      warning in 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
    • error

      public void error(String message, String sourceName, int line, String lineSource, int lineOffset)
      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 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
    • 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 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.
    • hasReportedError

      public boolean hasReportedError()
    • isReportingWarnings

      public boolean isReportingWarnings()
    • setIsReportingWarnings

      public void setIsReportingWarnings(boolean reportWarnings)
    • reportException

      public static void reportException(ErrorReporter er, RhinoException ex)
    • reportException

      public void reportException(RhinoException ex)