src/jdk/nashorn/internal/runtime/ECMAException.java

Print this page




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.internal.runtime;
  27 
  28 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
  29 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualField;
  30 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
  31 
  32 import javax.script.ScriptException;
  33 import jdk.nashorn.api.scripting.NashornException;
  34 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
  35 import jdk.nashorn.internal.codegen.CompilerConstants.FieldAccess;
  36 import jdk.nashorn.internal.objects.NativeError;
  37 
  38 /**
  39  * Exception used to implement ECMAScript "throw" from scripts. The actual thrown
  40  * object from script need not be a Java exception and so it is wrapped as an
  41  * instance field called "thrown" here. This exception class is also used to
  42  * represent ECMA errors thrown from runtime code (for example, TypeError,
  43  * ReferenceError thrown from Nashorn engine runtime).
  44  */
  45 @SuppressWarnings("serial")
  46 public final class ECMAException extends NashornException {
  47     /**
  48      * Method handle pointing to the constructor {@link ECMAException#create(Object, String, int, int)},
  49      */
  50     public static final Call CREATE = staticCallNoLookup(ECMAException.class, "create", ECMAException.class, Object.class, String.class, int.class, int.class);
  51 
  52     /** Field handle to the{@link ECMAException#thrown} field, so that it can be accessed from generated code */
  53     public static final FieldAccess THROWN = virtualField(ECMAException.class, "thrown", Object.class);
  54 
  55     private static final String EXCEPTION_PROPERTY = "nashornException";
  56 




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.internal.runtime;
  27 
  28 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
  29 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualField;
  30 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
  31 
  32 import javax.script.ScriptException;
  33 import jdk.nashorn.api.scripting.NashornException;
  34 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
  35 import jdk.nashorn.internal.codegen.CompilerConstants.FieldAccess;

  36 
  37 /**
  38  * Exception used to implement ECMAScript "throw" from scripts. The actual thrown
  39  * object from script need not be a Java exception and so it is wrapped as an
  40  * instance field called "thrown" here. This exception class is also used to
  41  * represent ECMA errors thrown from runtime code (for example, TypeError,
  42  * ReferenceError thrown from Nashorn engine runtime).
  43  */
  44 @SuppressWarnings("serial")
  45 public final class ECMAException extends NashornException {
  46     /**
  47      * Method handle pointing to the constructor {@link ECMAException#create(Object, String, int, int)},
  48      */
  49     public static final Call CREATE = staticCallNoLookup(ECMAException.class, "create", ECMAException.class, Object.class, String.class, int.class, int.class);
  50 
  51     /** Field handle to the{@link ECMAException#thrown} field, so that it can be accessed from generated code */
  52     public static final FieldAccess THROWN = virtualField(ECMAException.class, "thrown", Object.class);
  53 
  54     private static final String EXCEPTION_PROPERTY = "nashornException";
  55