- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- jdk.nashorn.api.scripting.NashornException
-
- All Implemented Interfaces:
Serializable
@Deprecated(since="11", forRemoval=true) public abstract class NashornException extends RuntimeException
Deprecated, for removal: This API element is subject to removal in a future version.Nashorn JavaScript script engine and APIs, and the jjs tool are deprecated with the intent to remove them in a future release.This is base exception for all Nashorn exceptions. These originate from user's ECMAScript code. Example: script parse errors, exceptions thrown from scripts. Note that ScriptEngine methods like "eval", "invokeMethod", "invokeFunction" will wrap this as ScriptException and throw it. But, there are cases where user may need to access this exception (or implementation defined subtype of this). For example, if java interface is implemented by a script object or Java access to script object properties via java.util.Map interface. In these cases, user code will get an instance of this or implementation defined subclass.- Since:
- 1.8u40
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NashornException(String msg, String fileName, int line, int column)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor to initialize error message, file name, line and column numbers.protected
NashornException(String msg, Throwable cause)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor to initialize error message and cause exception.protected
NashornException(String msg, Throwable cause, String fileName, int line, int column)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor to initialize error message, cause exception, file name, line and column numbers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getColumnNumber()
Deprecated, for removal: This API element is subject to removal in a future version.Get the column for thisNashornException
Object
getEcmaError()
Deprecated, for removal: This API element is subject to removal in a future version.Return the underlying ECMA error object, if available.String
getFileName()
Deprecated, for removal: This API element is subject to removal in a future version.Get the source file name for thisNashornException
int
getLineNumber()
Deprecated, for removal: This API element is subject to removal in a future version.Get the line number for thisNashornException
static StackTraceElement[]
getScriptFrames(Throwable exception)
Deprecated, for removal: This API element is subject to removal in a future version.Returns array javascript stack frames from the given exception object.static String
getScriptStackString(Throwable exception)
Deprecated, for removal: This API element is subject to removal in a future version.Return a formatted script stack trace string with frames information separated by '\n'protected Object
getThrown()
Deprecated, for removal: This API element is subject to removal in a future version.Get the thrown object.void
setColumnNumber(int column)
Deprecated, for removal: This API element is subject to removal in a future version.Set the column for thisNashornException
void
setEcmaError(Object ecmaError)
Deprecated, for removal: This API element is subject to removal in a future version.Return the underlying ECMA error object, if available.void
setFileName(String fileName)
Deprecated, for removal: This API element is subject to removal in a future version.Set the source file name for thisNashornException
void
setLineNumber(int line)
Deprecated, for removal: This API element is subject to removal in a future version.Set the line number for thisNashornException
-
Methods declared in class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
NashornException
protected NashornException(String msg, String fileName, int line, int column)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor to initialize error message, file name, line and column numbers.- Parameters:
msg
- exception messagefileName
- file nameline
- line numbercolumn
- column number
-
NashornException
protected NashornException(String msg, Throwable cause, String fileName, int line, int column)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor to initialize error message, cause exception, file name, line and column numbers.- Parameters:
msg
- exception messagecause
- exception causefileName
- file nameline
- line numbercolumn
- column number
-
-
Method Detail
-
getFileName
public final String getFileName()
Deprecated, for removal: This API element is subject to removal in a future version.Get the source file name for thisNashornException
- Returns:
- the file name
-
setFileName
public final void setFileName(String fileName)
Deprecated, for removal: This API element is subject to removal in a future version.Set the source file name for thisNashornException
- Parameters:
fileName
- the file name
-
getLineNumber
public final int getLineNumber()
Deprecated, for removal: This API element is subject to removal in a future version.Get the line number for thisNashornException
- Returns:
- the line number
-
setLineNumber
public final void setLineNumber(int line)
Deprecated, for removal: This API element is subject to removal in a future version.Set the line number for thisNashornException
- Parameters:
line
- the line number
-
getColumnNumber
public final int getColumnNumber()
Deprecated, for removal: This API element is subject to removal in a future version.Get the column for thisNashornException
- Returns:
- the column number
-
setColumnNumber
public final void setColumnNumber(int column)
Deprecated, for removal: This API element is subject to removal in a future version.Set the column for thisNashornException
- Parameters:
column
- the column number
-
getScriptFrames
public static StackTraceElement[] getScriptFrames(Throwable exception)
Deprecated, for removal: This API element is subject to removal in a future version.Returns array javascript stack frames from the given exception object.- Parameters:
exception
- exception from which stack frames are retrieved and filtered- Returns:
- array of javascript stack frames
-
getScriptStackString
public static String getScriptStackString(Throwable exception)
Deprecated, for removal: This API element is subject to removal in a future version.Return a formatted script stack trace string with frames information separated by '\n'- Parameters:
exception
- exception for which script stack string is returned- Returns:
- formatted stack trace string
-
getThrown
protected Object getThrown()
Deprecated, for removal: This API element is subject to removal in a future version.Get the thrown object. Subclass responsibility- Returns:
- thrown object
-
getEcmaError
public Object getEcmaError()
Deprecated, for removal: This API element is subject to removal in a future version.Return the underlying ECMA error object, if available.- Returns:
- underlying ECMA Error object's mirror or whatever was thrown from script such as a String, Number or a Boolean.
-
setEcmaError
public void setEcmaError(Object ecmaError)
Deprecated, for removal: This API element is subject to removal in a future version.Return the underlying ECMA error object, if available.- Parameters:
ecmaError
- underlying ECMA Error object's mirror or whatever was thrown from script such as a String, Number or a Boolean.
-
-