src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornException.java

Print this page




  24  */
  25 
  26 package jdk.nashorn.api.scripting;
  27 
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 import jdk.nashorn.internal.codegen.CompilerConstants;
  31 import jdk.nashorn.internal.runtime.ECMAErrors;
  32 import jdk.nashorn.internal.runtime.ScriptObject;
  33 
  34 /**
  35  * This is base exception for all Nashorn exceptions. These originate from
  36  * user's ECMAScript code. Example: script parse errors, exceptions thrown from
  37  * scripts. Note that ScriptEngine methods like "eval", "invokeMethod",
  38  * "invokeFunction" will wrap this as ScriptException and throw it. But, there
  39  * are cases where user may need to access this exception (or implementation
  40  * defined subtype of this). For example, if java interface is implemented by a
  41  * script object or Java access to script object properties via java.util.Map
  42  * interface. In these cases, user code will get an instance of this or
  43  * implementation defined subclass.


  44  */

  45 @SuppressWarnings("serial")
  46 public abstract class NashornException extends RuntimeException {
  47     // script file name
  48     private String fileName;
  49     // script line number
  50     private int line;
  51     // script column number
  52     private int column;
  53     // underlying ECMA error object - lazily initialized
  54     private Object ecmaError;
  55 
  56     /**
  57      * Constructor
  58      *
  59      * @param msg       exception message
  60      * @param fileName  file name
  61      * @param line      line number
  62      * @param column    column number
  63      */
  64     protected NashornException(final String msg, final String fileName, final int line, final int column) {




  24  */
  25 
  26 package jdk.nashorn.api.scripting;
  27 
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 import jdk.nashorn.internal.codegen.CompilerConstants;
  31 import jdk.nashorn.internal.runtime.ECMAErrors;
  32 import jdk.nashorn.internal.runtime.ScriptObject;
  33 
  34 /**
  35  * This is base exception for all Nashorn exceptions. These originate from
  36  * user's ECMAScript code. Example: script parse errors, exceptions thrown from
  37  * scripts. Note that ScriptEngine methods like "eval", "invokeMethod",
  38  * "invokeFunction" will wrap this as ScriptException and throw it. But, there
  39  * are cases where user may need to access this exception (or implementation
  40  * defined subtype of this). For example, if java interface is implemented by a
  41  * script object or Java access to script object properties via java.util.Map
  42  * interface. In these cases, user code will get an instance of this or
  43  * implementation defined subclass.
  44  *
  45  * @since 1.8u40
  46  */
  47 @jdk.Exported
  48 @SuppressWarnings("serial")
  49 public abstract class NashornException extends RuntimeException {
  50     // script file name
  51     private String fileName;
  52     // script line number
  53     private int line;
  54     // script column number
  55     private int column;
  56     // underlying ECMA error object - lazily initialized
  57     private Object ecmaError;
  58 
  59     /**
  60      * Constructor
  61      *
  62      * @param msg       exception message
  63      * @param fileName  file name
  64      * @param line      line number
  65      * @param column    column number
  66      */
  67     protected NashornException(final String msg, final String fileName, final int line, final int column) {