/** * {@inheritDoc} */ @Override public void onExceptionThrown(final Context cx, final Throwable t) { if (LOG.isTraceEnabled()) { if (t instanceof JavaScriptException) { final JavaScriptException e = (JavaScriptException) t; LOG.trace(getSourceName(cx) + ":" + getFirstLine(cx) + " Exception thrown: " + Context.toString(e.getValue())); } else { LOG.trace(getSourceName(cx) + ":" + getFirstLine(cx) + " Exception thrown: " + t.getCause()); } } }
/** * {@inheritDoc} */ @Override public void onExceptionThrown(final Context cx, final Throwable t) { if (LOG.isTraceEnabled()) { if (t instanceof JavaScriptException) { final JavaScriptException e = (JavaScriptException) t; LOG.trace(getSourceName(cx) + ":" + getFirstLine(cx) + " Exception thrown: " + Context.toString(e.getValue())); } else { LOG.trace(getSourceName(cx) + ":" + getFirstLine(cx) + " Exception thrown: " + t.getCause()); } } }
/** * {@inheritDoc} */ @Override public void onExceptionThrown(final Context cx, final Throwable t) { if (LOG.isTraceEnabled()) { if (t instanceof JavaScriptException) { final JavaScriptException e = (JavaScriptException) t; LOG.trace(getSourceName(cx) + ":" + getFirstLine(cx) + " Exception thrown: " + Context.toString(e.getValue())); } else { LOG.trace(getSourceName(cx) + ":" + getFirstLine(cx) + " Exception thrown: " + t.getCause()); } } }
final Object value = ((JavaScriptException) getCause()).getValue();
final Object value = ((JavaScriptException) getCause()).getValue();
final Object value = ((JavaScriptException) getCause()).getValue();
final Object value = ((JavaScriptException) getCause()).getValue();
final Object value = ((JavaScriptException) getCause()).getValue();
returnPromise.settle(false, e.getValue(), window);
returnPromise.settle(false, e.getValue(), window);
return Boolean.TRUE; } catch (JavaScriptException e) { if (e.getValue() instanceof NativeIterator.StopIteration) { return Boolean.FALSE;
/** * Triggers the {@code onerror} handler, if one has been set. * @param e the error that needs to be reported */ public void triggerOnError(final ScriptException e) { final Object o = getOnerror(); if (o instanceof Function) { final Function f = (Function) o; String msg = e.getMessage(); final String url = e.getPage().getUrl().toExternalForm(); final int line = e.getFailingLineNumber(); final int column = e.getFailingColumnNumber(); Object jsError = e.getMessage(); if (e.getCause() instanceof JavaScriptException) { msg = "uncaught exception: " + e.getCause().getMessage(); jsError = ((JavaScriptException) e.getCause()).getValue(); } else if (e.getCause() instanceof EcmaError) { msg = "uncaught " + e.getCause().getMessage(); final EcmaError ecmaError = (EcmaError) e.getCause(); final Scriptable err = Context.getCurrentContext().newObject(this, "Error"); ScriptableObject.putProperty(err, "message", ecmaError.getMessage()); ScriptableObject.putProperty(err, "fileName", ecmaError.sourceName()); ScriptableObject.putProperty(err, "lineNumber", Integer.valueOf(ecmaError.lineNumber())); jsError = err; } final Object[] args = new Object[] {msg, url, Integer.valueOf(line), Integer.valueOf(column), jsError}; f.call(Context.getCurrentContext(), this, this, args); } }
/** * Triggers the {@code onerror} handler, if one has been set. * @param e the error that needs to be reported */ public void triggerOnError(final ScriptException e) { final Object o = getOnerror(); if (o instanceof Function) { final Function f = (Function) o; String msg = e.getMessage(); final String url = e.getPage().getUrl().toExternalForm(); final int line = e.getFailingLineNumber(); final int column = e.getFailingColumnNumber(); Object jsError = e.getMessage(); if (e.getCause() instanceof JavaScriptException) { msg = "uncaught exception: " + e.getCause().getMessage(); jsError = ((JavaScriptException) e.getCause()).getValue(); } else if (e.getCause() instanceof EcmaError) { msg = "uncaught " + e.getCause().getMessage(); final EcmaError ecmaError = (EcmaError) e.getCause(); final Scriptable err = Context.getCurrentContext().newObject(this, "Error"); ScriptableObject.putProperty(err, "message", ecmaError.getMessage()); ScriptableObject.putProperty(err, "fileName", ecmaError.sourceName()); ScriptableObject.putProperty(err, "lineNumber", Integer.valueOf(ecmaError.lineNumber())); jsError = err; } final Object[] args = new Object[] {msg, url, Integer.valueOf(line), Integer.valueOf(column), jsError}; f.call(Context.getCurrentContext(), this, this, args); } }
thisPromise.settle(false, e.getValue(), window);
thisPromise.settle(false, e.getValue(), window);
if (t instanceof JavaScriptException) { cacheObj = false; obj = ((JavaScriptException)t).getValue(); } else { cacheObj = true;