code: public static EvaluatorException reportRuntimeError(String message,
                                                          String sourceName,
                                                          int lineno,
                                                          String lineSource,
                                                          int lineOffset)
      {
          Context cx = getCurrentContext();
          if (cx != null) {
              return cx.getErrorReporter().
                              runtimeError(message, sourceName, lineno,
                                           lineSource, lineOffset);
          }
          throw new EvaluatorException(message, sourceName, lineno, lineSource, lineOffset);
      }
docs: Report a runtime 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
  @return a runtime exception that will be thrown to terminate the
  execution of the script
  @see org.mozilla.javascript.ErrorReporter