Previous     Contents     Index     Next     
Core JavaScript Reference 1.5





JSException

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:



Constructor

Description

JSException

 

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


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



Method

Description

getWrappedException

 

Instance method getWrappedException.  

getWrappedExceptionType

 

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

The following sections show the declaration and usage of the constructors and method.


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 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 if 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  


Previous     Contents     Index     Next     
Copyright © 2000 Netscape Communications Corp. All rights reserved.

Last Updated September 28, 2000