LOG.debug("Wrapping XPathException in StepFailedException: " + e.getMessage());
throw new StepFailedException(e.getMessage(), (Exception) e);
}
else if (e instanceof ScriptException)
{
final ScriptException se = (ScriptException) e;
final HtmlPage page = se.getPage(); // should normally not be null but it happens in HtmlUnit 1.14 ;-(
final StepFailedException sfe = new StepFailedException(
"JavaScript error loading page "
+ (page != null ? page.getWebResponse().getUrl().toString() : "")
+ ": " + se.getMessage(), se);
sfe.addDetail("javascript error", se.getMessage());
sfe.addDetail("line", String.valueOf(se.getFailingLineNumber()));
sfe.addDetail("javascript source", se.getScriptSourceCode());
sfe.addDetail("failing line", se.getFailingLine());
// the javascript call stack
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
se.printScriptStackTrace(printWriter);
sfe.addDetail("javascript call stack", stringWriter.toString());
throw sfe;
}
else if (e instanceof SocketTimeoutException)