com.gargoylesoftware.htmlunit
Class ScriptException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.gargoylesoftware.htmlunit.ScriptException
All Implemented Interfaces:
java.io.Serializable

public class ScriptException
extends java.lang.RuntimeException

An exception that will be thrown if an error occurs during the processing of a script.

Version:
$Revision: 1.3 $
Author:
Mike Bowler, Marc Guillemot
See Also:
Serialized Form

Constructor Summary
ScriptException(HtmlPage page, java.lang.Throwable throwable)
 Create an instance
ScriptException(HtmlPage page, java.lang.Throwable throwable, java.lang.String scriptSourceCode)
 Creates an instance.
 
Method Summary
 java.lang.String getFailingLine()
 Return the line of source that was being executed when this exception was thrown.
 int getFailingLineNumber()
 Return the line number of the source that was executing at the time of the exception.
 HtmlPage getPage()
 Gets the html page in which the script error occurred.
 java.lang.String getScriptSourceCode()
 Return the source code line that failed
 void printScriptStackTrace(java.io.PrintWriter writer)
 Print the script stack trace.
 void printStackTrace()
 Print the stack trace to System.out.
 void printStackTrace(java.io.PrintStream stream)
 Print the stack trace.
 void printStackTrace(java.io.PrintWriter writer)
 Print the stack trace.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScriptException

public ScriptException(HtmlPage page,
                       java.lang.Throwable throwable)
Create an instance

Parameters:
page - the page in which the script causing this exception was executed
throwable - The exception that was thrown from the script engine.

ScriptException

public ScriptException(HtmlPage page,
                       java.lang.Throwable throwable,
                       java.lang.String scriptSourceCode)
Creates an instance.

Parameters:
page - the page in which the script causing this exception was executed
throwable - The exception that was thrown from the script engine.
scriptSourceCode - The code that was being executed when this exception was thrown. This may be null if the exception was not caused by execution of javascript.
Method Detail

getFailingLine

public java.lang.String getFailingLine()
Return the line of source that was being executed when this exception was thrown.

Returns:
The line of source or an empty string if the exception was not thrown due to the execution of a script.

getFailingLineNumber

public int getFailingLineNumber()
Return the line number of the source that was executing at the time of the exception.

Returns:
The line number or -1 if the exception was not thrown due to the execution of a script.

getPage

public HtmlPage getPage()
Gets the html page in which the script error occurred.
Caution: this page may be only partially parsed if the exception occurred in a script executed at parsing time.

Returns:
the page

getScriptSourceCode

public java.lang.String getScriptSourceCode()
Return the source code line that failed

Returns:
the source code line that failed

printScriptStackTrace

public void printScriptStackTrace(java.io.PrintWriter writer)
Print the script stack trace. This represents only the script calls.

Parameters:
writer - where the stack trace will be written

printStackTrace

public void printStackTrace()
Print the stack trace to System.out. If this exception contains another exception then the stack traces for both will be printed.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream stream)
Print the stack trace. If this exception contains another exception then the stack traces for both will be printed.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
stream - Where the stack trace will be written

printStackTrace

public void printStackTrace(java.io.PrintWriter writer)
Print the stack trace. If this exception contains another exception then the stack traces for both will be printed.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
writer - Where the stack trace will be written


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.