Class 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.
    • 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 message
        fileName - file name
        line - line number
        column - 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 message
        cause - exception cause
        fileName - file name
        line - line number
        column - column number
      • NashornException

        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.
        Parameters:
        msg - exception message
        cause - exception cause
    • 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 this NashornException
        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 this NashornException
        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 this NashornException
        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 this NashornException
        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 this NashornException
        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 this NashornException
        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.

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部