org.mozilla.javascript.EvaluatorException类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 JavaScript  
字(5.7k)|赞(0)|评价(0)|浏览(491)

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

EvaluatorException介绍

[英]The class of exceptions thrown by the JavaScript engine.
[中]JavaScript引擎引发的异常类。

代码示例

代码示例来源:origin: jooby-project/jooby

@Override
public EvaluatorException runtimeError(final String message, final String sourceName,
  final int line,
  final String lineSource, final int lineOffset) {
 return new EvaluatorException(message, filename, line, lineSource, lineOffset);
}

代码示例来源:origin: pentaho/pentaho-kettle

if ( e.getCause() instanceof EvaluatorException ) {
 EvaluatorException ee = (EvaluatorException) e.getCause();
 location = "--> " + ee.lineNumber() + ":" + ee.columnNumber();

代码示例来源:origin: pentaho/pentaho-kettle

} catch ( EvaluatorException Signal ) {
 Context.reportError( "EvaluatorException while evaluating file \""
  + fileName + "\" (reason: \"" + Signal.getMessage() + "\")" );
} catch ( JavaScriptException Signal ) {
 Context.reportError( "JavaScriptException while evaluating file \""

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

/**
 * This is a V8 extension that causes a native Error object to have a stack trace inserted at the point
 * at which it's called. It takes two arguments -- the first is an Error object and the second
 * is an optional function name for trimming the stack trace. We will only implement the first.
 */
private static Object js_captureStackTrace(Context cx, Scriptable scope, Object[] args)
{
  if (args.length < 1) {
    throw ScriptRuntime.typeError("first argument must be an Object");
  }
  Scriptable obj;
  try {
    obj = (Scriptable)args[0];
  } catch (ClassCastException cce) {
    throw ScriptRuntime.typeError("err must be an Object");
  }
  EvaluatorException exc = new EvaluatorException(null);
  exc.fillInStackTrace();
  Object stack = exc.getPreparedScriptStackTrace(cx, scope, obj);
  obj.delete("stack");
  obj.put("stack", obj, stack);
  return Undefined.instance;
}

代码示例来源:origin: ca.carleton.gcrc/nunaliit2-javascript

public void addJavascript(Reader reader, String name, int lineno) throws Exception {
  try {
    Script script = cx.compileReader(reader, name, lineno, null);
    script.exec(cx, scope);
    
  } catch(EvaluatorException e) {
    for(JavascriptRunnerListener listener : listeners){
      listener.compileError(e.details(), e.sourceName(), e.lineNumber(), e.columnNumber());
    }
    throw e;
  } catch(Exception e) {
    reportUnexpectedError(e);
    throw e;
  }
}

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

protected void appendError(StringBuffer errors, int errorCount,
    EvaluatorException e)
{
  errors.append(errorCount);
  errors.append(". ");
  String message = e.getMessage();
  errors.append(message);
  errors.append(" at column ");
  errors.append(e.columnNumber());
  String lineSource = e.lineSource();
  if (lineSource != null)
  {
    errors.append(" in line\n");
    errors.append(lineSource);
  }
  errors.append("\n");
}

代码示例来源:origin: com.mangofactory/typescript4j

message.append("Failed to initialize Typescript compiler\nerror on line " + e.lineNumber() + ": " +
    e.details() + "\n" + e.lineSource() + "\n");
for (int x = 0; x < e.columnNumber() - 1; x++) {
  message.append(" ");

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

/**
 * @deprecated Use {@link RhinoException#columnNumber()} from the super class.
 */
public int getColumnNumber()
{
  return columnNumber();
}

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

/**
 * @deprecated Use {@link RhinoException#lineNumber()} from the super class.
 */
public int getLineNumber()
{
  return lineNumber();
}

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

/**
 * @deprecated Use {@link RhinoException#lineSource()} from the super class.
 */
public String getLineSource()
{
  return lineSource();
}

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

/**
 * @deprecated Use {@link RhinoException#sourceName()} from the super class.
 */
public String getSourceName()
{
  return sourceName();
}

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

/**
 * @deprecated Use {@link RhinoException#columnNumber()} from the super class.
 */
public int getColumnNumber()
{
  return columnNumber();
}

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

/**
 * @deprecated Use {@link RhinoException#lineNumber()} from the super class.
 */
public int getLineNumber()
{
  return lineNumber();
}

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

/**
 * @deprecated Use {@link RhinoException#lineSource()} from the super class.
 */
public String getLineSource()
{
  return lineSource();
}

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

/**
 * @deprecated Use {@link RhinoException#sourceName()} from the super class.
 */
public String getSourceName()
{
  return sourceName();
}

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

@Override
public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource,
                    int lineOffset) {
  if (sourceName == null) {
    sourceName = filename;
  }
  error(message, sourceName, line, lineSource, lineOffset);
  return new EvaluatorException(message);
}

代码示例来源:origin: pentaho/pentaho-kettle

String position = "(" + e.lineNumber() + ":" + e.columnNumber() + ")";
String message = BaseMessages.getString( PKG, "ScriptDialog.Exception.CouldNotExecuteScript", position );
testException = new KettleException( message, e );

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

/**
 * @deprecated
 * @see #jsToJava(Object, Class)
 * @throws IllegalArgumentException if the conversion cannot be performed.
 *         Note that {@link #jsToJava(Object, Class)} throws
 *         {@link EvaluatorException} instead.
 */
@Deprecated
public static Object toType(Object value, Class<?> desiredType)
  throws IllegalArgumentException
{
  try {
    return jsToJava(value, desiredType);
  } catch (EvaluatorException ex) {
    IllegalArgumentException
      ex2 = new IllegalArgumentException(ex.getMessage());
    Kit.initCause(ex2, ex);
    throw ex2;
  }
}

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

/**
 * @deprecated Use {@link RhinoException#columnNumber()} from the super class.
 */
public int getColumnNumber()
{
  return columnNumber();
}

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

/**
 * @deprecated Use {@link RhinoException#lineNumber()} from the super class.
 */
public int getLineNumber()
{
  return lineNumber();
}

相关文章