code: public static void reportError(String message, String sourceName,
                                     int lineno, String lineSource,
                                     int lineOffset)
      {
          Context cx = getCurrentContext();
          if (cx != null) {
              cx.getErrorReporter().error(message, sourceName, lineno,
                                          lineSource, lineOffset);
          } else {
              throw new EvaluatorException(message, sourceName, lineno,
                                           lineSource, lineOffset);
          }
      }
docs: Report an error using the error reporter for the current thread.
  
  @param message the error message to report
  @param sourceName a string describing the source, such as a filename
  @param lineno the starting line number
  @param lineSource the text of the line (may be null)
  @param lineOffset the offset into lineSource where problem was detected
  @see org.mozilla.javascript.ErrorReporter