JSException

Summary

The public class JSException extends RuntimeException

java.lang.Object
   |
   +----java.lang.Throwable
            |
            +----java.lang.Exception
                     |
                     +----java.lang.RuntimeException
                                 |
                                 +----netscape.javascript.JSException

Description

JSException is an exception which is thrown when JavaScript code returns an error.

Constructor Summary

The netscape.javascript.JSException class has the following constructors:

JSException 
Deprecated constructors optionally let you specify a detail message and other information.

Method Summary

The netscape.javascript.JSException class has the following methods:

getWrappedException 
Instance method getWrappedException.
getWrappedExceptionType 
Instance method getWrappedExceptionType returns the int mapping of the type of the wrappedException object.

Backward Compatibility

JavaScript 1.1 through 1.3

JSException had three public constructors which optionally took a string argument, specifying the detail message or other information for the exception. The getWrappedException method was not available.

JSException constructors, deprecated in JavaScript 1.4, constructs a JSException object with an optional detail message.

Declaration

1. public JSException()
2. public JSException(String s)
3. public JSException(String s,
   String filename,
   int lineno,
   String source,
   int tokenIndex)

Arguments

s 
The detail message.
filename 
The URL of the file where the error occurred, if possible.
lineno 
The line number of the file, if possible.
source 
The string containing the JavaScript code being evaluated.
tokenIndex 
The index into the source string where the error occurred.

getWrappedException

Instance method getWrappedException.

Declaration

public Object getWrappedException()

Description

getWrappedException() returns an object that represents the value that the JavaScript actually threw. JavaScript can throw any type of value. Use getWrappedException() to determine what kind of value the Object return type represents.

getWrappedExceptionType

Instance method getWrappedExceptionType.

Declaration

public int getWrappedExceptionType()

Description

getWrappedExceptionType() returns an int that matches one of the following static ints declared by the JSException class:

  • EXCEPTION_TYPE_EMPTY
  • EXCEPTION_TYPE_VOID
  • EXCEPTION_TYPE_OBJECT
  • EXCEPTION_TYPE_FUNCTION
  • EXCEPTION_TYPE_STRING
  • EXCEPTION_TYPE_NUMBER
  • EXCEPTION_TYPE_BOOLEAN

Document Tags and Contributors

 Contributors to this page: fscholz, Montehansen, Mgjbot, Dria
 Last updated by: fscholz,