netscape.javascript.JSException Maven / Gradle / Ivy
Show all versions of openjfx-78-backport Show documentation
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package netscape.javascript;
/**
* Thrown when an exception is raised in the JavaScript engine.
*
*
* Much of the functionality in this class is deprecated as it is
* not portable between web browsers. The only functionality that
* should be relied upon is the throwing of this exception and calls
* to printStackTrace()
.
*/
public class JSException extends RuntimeException {
// Exception type supported by JavaScript 1.4 in Navigator 5.0.
//
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_EMPTY = -1;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_VOID = 0;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_OBJECT = 1;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_FUNCTION = 2;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_STRING = 3;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_NUMBER = 4;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_BOOLEAN = 5;
/** @deprecated Not portable between web browsers. */
public static final int EXCEPTION_TYPE_ERROR = 6;
/**
* Constructs a JSException object.
*
*/
public JSException() {
this(null);
}
/**
* Construct a JSException object with a detail message.
*
*
* @param s The detail message
*/
public JSException(String s) {
this(s, null, -1, null, -1);
}
/**
* Construct a JSException object. This constructor is
* deprecated as it involves non-portable functionality.
*
* @param s The detail message.
* @param filename The URL of the file where the error occurred, if possible.
* @param lineno The line number if the file, if possible.
* @param source The string containing the JavaScript code being evaluated.
* @param tokenIndex The index into the source string where the error occurred.
* @deprecated Not portable between web browsers.
*/
public JSException(String s, String filename, int lineno, String source,
int tokenIndex) {
super(s);
this.message = s;
this.filename = filename;
this.lineno = lineno;
this.source = source;
this.tokenIndex = tokenIndex;
this.wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
}
/**
* Construct a JSException object. This constructor is
* deprecated as it involves non-portable functionality.
*
* @param wrappedExceptionType Type of the wrapped JavaScript exception.
* @param wrappedException JavaScript exception wrapper.
* @deprecated Not portable between web browsers.
*/
public JSException(int wrappedExceptionType, Object wrappedException) {
this();
this.wrappedExceptionType = wrappedExceptionType;
this.wrappedException = wrappedException;
}
/**
* The detail message.
* @deprecated Not portable between web browsers.
*/
protected String message = null;
/**
* The URL of the file where the error occurred, if possible.
* @deprecated Not portable between web browsers.
*/
protected String filename = null;
/**
* The line number if the file, if possible.
* @deprecated Not portable between web browsers.
*/
protected int lineno = -1;
/**
* The string containing the JavaScript code being evaluated.
* @deprecated Not portable between web browsers.
*/
protected String source = null;
/**
* The index into the source string where the error occurred.
* @deprecated Not portable between web browsers.
*/
protected int tokenIndex = -1;
/**
* Type of the wrapped JavaScript exception.
* @deprecated Not portable between web browsers.
*/
private int wrappedExceptionType = -1;
/**
* JavaScript exception wrapper.
* @deprecated Not portable between web browsers.
*/
private Object wrappedException = null;
/**
* getWrappedExceptionType returns the int mapping of the type
* of the wrappedException Object. This method is deprecated as it
* involves non-portable functionality.
*
* @return int JavaScript exception type.
* @deprecated Not portable between web browsers.
*/
public int getWrappedExceptionType() {
return wrappedExceptionType;
}
/**
* Returns the wrapped JavaScript exception. This method is
* deprecated as it involves non-portable functionality.
*
* @return Object JavaScript exception wrapper.
* @deprecated Not portable between web browsers.
*/
public Object getWrappedException() {
return wrappedException;
}
}