Search in sources :

Example 1 with RhinoException

use of net.sourceforge.htmlunit.corejs.javascript.RhinoException in project htmlunit by HtmlUnit.

the class Console method trace.

/**
 * This method performs logging to the console at {@code trace} level.
 * @param cx the JavaScript context
 * @param thisObj the scriptable
 * @param args the arguments passed into the method
 * @param funObj the function
 */
@JsxFunction
public static void trace(final Context cx, final Scriptable thisObj, final Object[] args, final Function funObj) {
    final RhinoException e = ScriptRuntime.throwError(cx, funObj, null);
    final WebConsole webConsole = toWebConsole(thisObj);
    final Formatter oldFormatter = webConsole.getFormatter();
    webConsole.setFormatter(FORMATTER_);
    webConsole.info(e.getScriptStackTrace());
    webConsole.setFormatter(oldFormatter);
}
Also used : WebConsole(com.gargoylesoftware.htmlunit.WebConsole) Formatter(com.gargoylesoftware.htmlunit.WebConsole.Formatter) RhinoException(net.sourceforge.htmlunit.corejs.javascript.RhinoException) JsxFunction(com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction)

Aggregations

WebConsole (com.gargoylesoftware.htmlunit.WebConsole)1 Formatter (com.gargoylesoftware.htmlunit.WebConsole.Formatter)1 JsxFunction (com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction)1 RhinoException (net.sourceforge.htmlunit.corejs.javascript.RhinoException)1