}
else if (e instanceof FailingHttpStatusCodeException)
{
LOG.debug("Wrapping FailingHttpStatusCodeException in StepFailedException: " + e.getMessage());
final FailingHttpStatusCodeException he = (FailingHttpStatusCodeException) e;
throw new StepFailedException("HTTP error " + he.getStatusCode(), he);
}
else if (e instanceof XPathException)
{
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)
{
final SocketTimeoutException ste = (SocketTimeoutException) e;
throw new StepFailedException("Server took to long to answer: "
+ ste.getMessage(), ste);
}
else if (e instanceof SAXException)
{
throw new StepExecutionException("Response is not well-formed: "