org.mozilla.javascript.JavaScriptException.recordErrorOrigin()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 JavaScript  
字(4.2k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.mozilla.javascript.JavaScriptException.recordErrorOrigin()方法的一些代码示例,展示了JavaScriptException.recordErrorOrigin()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaScriptException.recordErrorOrigin()方法的具体详情如下:
包路径:org.mozilla.javascript.JavaScriptException
类名称:JavaScriptException
方法名:recordErrorOrigin

JavaScriptException.recordErrorOrigin介绍

暂无

代码示例

代码示例来源:origin: rhino/js

/**
 * Create a JavaScript exception wrapping the given JavaScript value
 *
 * @param value the JavaScript value thrown.
 */
public JavaScriptException(Object value, String sourceName, int lineNumber)
{
  recordErrorOrigin(sourceName, lineNumber, null, 0);
  this.value = value;
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

/**
 * Create a JavaScript exception wrapping the given JavaScript value
 *
 * @param value the JavaScript value thrown.
 */
public JavaScriptException(Object value, String sourceName, int lineNumber)
{
  recordErrorOrigin(sourceName, lineNumber, null, 0);
  this.value = value;
}

代码示例来源:origin: com.github.tntim96/rhino

/**
 * Create a JavaScript exception wrapping the given JavaScript value
 *
 * @param value the JavaScript value thrown.
 */
public JavaScriptException(Object value, String sourceName, int lineNumber)
{
  recordErrorOrigin(sourceName, lineNumber, null, 0);
  this.value = value;
  // Fill in fileName and lineNumber automatically when not specified
  // explicitly, see Bugzilla issue #342807
  if (value instanceof NativeError && Context.getContext()
      .hasFeature(Context.FEATURE_LOCATION_INFORMATION_IN_ERROR)) {
    NativeError error = (NativeError) value;
    if (!error.has("fileName", error)) {
      error.put("fileName", error, sourceName);
    }
    if (!error.has("lineNumber", error)) {
      error.put("lineNumber", error, Integer.valueOf(lineNumber));
    }
    // set stack property, see bug #549604
    error.setStackProvider(this);
  }
}

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 * Create a JavaScript exception wrapping the given JavaScript value
 *
 * @param value the JavaScript value thrown.
 */
public JavaScriptException(Object value, String sourceName, int lineNumber)
{
  recordErrorOrigin(sourceName, lineNumber, null, 0);
  this.value = value;
  // Fill in fileName and lineNumber automatically when not specified
  // explicitly, see Bugzilla issue #342807
  if (value instanceof NativeError && Context.getContext()
      .hasFeature(Context.FEATURE_LOCATION_INFORMATION_IN_ERROR)) {
    NativeError error = (NativeError) value;
    if (!error.has("fileName", error)) {
      error.put("fileName", error, sourceName);
    }
    if (!error.has("lineNumber", error)) {
      error.put("lineNumber", error, Integer.valueOf(lineNumber));
    }
    // set stack property, see bug #549604
    error.setStackProvider(this);
  }
}

代码示例来源:origin: geogebra/geogebra

/**
 * Create a JavaScript exception wrapping the given JavaScript value
 *
 * @param value the JavaScript value thrown.
 */
public JavaScriptException(Object value, String sourceName, int lineNumber)
{
  recordErrorOrigin(sourceName, lineNumber, null, 0);
  this.value = value;
  // Fill in fileName and lineNumber automatically when not specified
  // explicitly, see Bugzilla issue #342807
  if (value instanceof NativeError && Context.getContext()
      .hasFeature(Context.FEATURE_LOCATION_INFORMATION_IN_ERROR)) {
    NativeError error = (NativeError) value;
    if (!error.has("fileName", error)) {
      error.put("fileName", error, sourceName);
    }
    if (!error.has("lineNumber", error)) {
      error.put("lineNumber", error, Integer.valueOf(lineNumber));
    }
    // set stack property, see bug #549604
    error.setStackProvider(this);
  }
}

代码示例来源:origin: io.apigee/rhino

/**
 * Create a JavaScript exception wrapping the given JavaScript value
 *
 * @param value the JavaScript value thrown.
 */
public JavaScriptException(Object value, String sourceName, int lineNumber) {
  recordErrorOrigin(sourceName, lineNumber, null, 0);
  this.value = value;
  // Fill in fileName and lineNumber automatically when not specified
  // explicitly, see Bugzilla issue #342807
  if (value instanceof Scriptable && Context.getContext().hasFeature(Context.FEATURE_LOCATION_INFORMATION_IN_ERROR)) {
    Scriptable obj = (Scriptable) value;
    while(obj != null && !(obj instanceof NativeError)) {
      obj = obj.getPrototype();
    }
    if (obj != null) {
      NativeError error = (NativeError) obj;
      if (!error.has("fileName", error)) {
        error.put("fileName", error, sourceName);
      }
      if (!error.has("lineNumber", error)) {
        error.put("lineNumber", error, Integer.valueOf(lineNumber));
      }
      // set stack property, see bug #549604
      error.setStackProvider(this);
    }
  }
}

相关文章