本文整理了Java中org.mozilla.javascript.RhinoException.toString
方法的一些代码示例,展示了RhinoException.toString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RhinoException.toString
方法的具体详情如下:
包路径:org.mozilla.javascript.RhinoException
类名称:RhinoException
方法名:toString
暂无
代码示例来源:origin: com.github.tntim96/rhino
private static String getExceptionMessage(RhinoException ex)
{
String msg;
if (ex instanceof JavaScriptException) {
msg = getMessage("msg.uncaughtJSException", ex.details());
} else if (ex instanceof EcmaError) {
msg = getMessage("msg.uncaughtEcmaError", ex.details());
} else if (ex instanceof EvaluatorException) {
msg = ex.details();
} else {
msg = ex.toString();
}
return msg;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private static String getExceptionMessage(RhinoException ex)
{
String msg;
if (ex instanceof JavaScriptException) {
msg = getMessage("msg.uncaughtJSException", ex.details());
} else if (ex instanceof EcmaError) {
msg = getMessage("msg.uncaughtEcmaError", ex.details());
} else if (ex instanceof EvaluatorException) {
msg = ex.details();
} else {
msg = ex.toString();
}
return msg;
}
代码示例来源:origin: cat.inspiracio/rhino-js-engine
public Object eval(ScriptContext context) throws ScriptException {
Object result = null;
Context cx = RhinoScriptEngine.enterContext();
try {
Scriptable scope = engine.getRuntimeScope(context);
Object ret = script.exec(cx, scope);
result = engine.unwrapReturnValue(ret);
} catch (JavaScriptException jse) {
if (DEBUG) jse.printStackTrace();
int line = (line = jse.lineNumber()) == 0 ? -1 : line;
Object value = jse.getValue();
String str = (value != null && value.getClass().getName().equals("org.mozilla.javascript.NativeError") ?
value.toString() :
jse.toString());
throw new ExtendedScriptException(jse, str, jse.sourceName(), line);
} catch (RhinoException re) {
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} finally {
Context.exit();
}
return result;
}
代码示例来源:origin: com.google.code.scriptengines/scriptengines-javascript
public Object eval(ScriptContext context) throws ScriptException {
Object result = null;
Context cx = RhinoScriptEngine.enterContext();
try {
Scriptable scope = engine.getRuntimeScope(context);
Object ret = script.exec(cx, scope);
result = engine.unwrapReturnValue(ret);
} catch (JavaScriptException jse) {
if (DEBUG) jse.printStackTrace();
int line = (line = jse.lineNumber()) == 0 ? -1 : line;
Object value = jse.getValue();
String str = (value != null && value.getClass().getName().equals("org.mozilla.javascript.NativeError") ?
value.toString() :
jse.toString());
throw new ExtendedScriptException(jse, str, jse.sourceName(), line);
} catch (RhinoException re) {
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} finally {
Context.exit();
}
return result;
}
代码示例来源:origin: rhq-project/rhq
@Override
public Object eval(ScriptContext context) throws ScriptException {
Object result = null;
Context cx = RhinoScriptEngine.enterContext();
try {
Scriptable scope = engine.getRuntimeScope(context);
Object ret = script.exec(cx, scope);
result = engine.unwrapReturnValue(ret);
} catch (JavaScriptException jse) {
if (DEBUG) jse.printStackTrace();
int line = (line = jse.lineNumber()) == 0 ? -1 : line;
Object value = jse.getValue();
String str = (value != null && value.getClass().getName().equals("org.mozilla.javascript.NativeError") ?
value.toString() :
jse.toString());
throw new ExtendedScriptException(jse, str, jse.sourceName(), line);
} catch (RhinoException re) {
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} finally {
Context.exit();
}
return result;
}
代码示例来源:origin: com.google.code.scriptengines/scriptengines-javascript
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} finally {
cx.exit();
代码示例来源:origin: cat.inspiracio/rhino-js-engine
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} finally {
Context.exit();
代码示例来源:origin: rhq-project/rhq
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} finally {
Context.exit();
代码示例来源:origin: io.apisense/rhino-android
public Object eval(ScriptContext context) throws ScriptException {
Object result = null;
Context cx = RhinoScriptEngine.enterContext();
try {
Scriptable scope = engine.getRuntimeScope(context);
Object ret = script.exec(cx, scope);
result = engine.unwrapReturnValue(ret);
} catch (RhinoException re) {
int line = (line = re.lineNumber()) == 0 ? -1 : line;
String msg;
if (re instanceof JavaScriptException) {
msg = String.valueOf(((JavaScriptException)re).getValue());
} else {
msg = re.toString();
}
ScriptException se = new ScriptException(msg, re.sourceName(), line);
se.initCause(re);
throw se;
} finally {
Context.exit();
}
return result;
}
代码示例来源:origin: io.apisense/rhino-android
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
ScriptException se = new ScriptException(re.toString(), re.sourceName(), line);
se.initCause(re);
throw se;
代码示例来源:origin: io.apisense/rhino-android
public Object eval(Reader reader, ScriptContext ctxt)
throws ScriptException {
Object ret;
Context cx = enterContext();
try {
Scriptable scope = getRuntimeScope(ctxt);
String filename = (String) get(ScriptEngine.FILENAME);
filename = filename == null ? "<Unknown source>" : filename;
ret = cx.evaluateReader(scope, reader, filename , 1, null);
} catch (RhinoException re) {
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
String msg;
if (re instanceof JavaScriptException) {
msg = String.valueOf(((JavaScriptException)re).getValue());
} else {
msg = re.toString();
}
ScriptException se = new ScriptException(msg, re.sourceName(), line);
se.initCause(re);
throw se;
} catch (IOException ee) {
throw new ScriptException(ee);
} finally {
cx.exit();
}
return unwrapReturnValue(ret);
}
代码示例来源:origin: com.google.code.scriptengines/scriptengines-javascript
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} catch (IOException ee) {
throw new ScriptException(ee);
代码示例来源:origin: cat.inspiracio/rhino-js-engine
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} catch (IOException ee) {
throw new ScriptException(ee);
代码示例来源:origin: rhq-project/rhq
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line);
} catch (IOException ee) {
throw new ScriptException(ee);
内容来源于网络,如有侵权,请联系作者删除!