src/jdk/nashorn/internal/objects/NativeError.java

Print this page




  75 
  76     /** Message property name */
  77     @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE)
  78     public Object instMessage;
  79 
  80     /** ECMA 15.11.4.2 Error.prototype.name */
  81     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
  82     public Object name;
  83 
  84     /** ECMA 15.11.4.3 Error.prototype.message */
  85     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
  86     public Object message;
  87 
  88     /** Nashorn extension: underlying exception */
  89     @Property(attributes = Attribute.NOT_ENUMERABLE)
  90     public Object nashornException;
  91 
  92     // initialized by nasgen
  93     private static PropertyMap $nasgenmap$;
  94 
  95     static PropertyMap getInitialMap() {
  96         return $nasgenmap$;
  97     }
  98 
  99     @SuppressWarnings("LeakingThisInConstructor")
 100     private NativeError(final Object msg, final ScriptObject proto, final PropertyMap map) {
 101         super(proto, map);
 102         if (msg != UNDEFINED) {
 103             this.instMessage = JSType.toString(msg);
 104         } else {
 105             this.delete(NativeError.MESSAGE, false);
 106         }
 107         initException(this);
 108     }
 109 
 110     NativeError(final Object msg, final Global global) {
 111         this(msg, global.getErrorPrototype(), getInitialMap());
 112     }
 113 
 114     private NativeError(final Object msg) {
 115         this(msg, Global.instance());
 116     }
 117 
 118     @Override
 119     public String getClassName() {
 120         return "Error";
 121     }
 122 
 123     /**
 124      * ECMA 15.11.2 The Error Constructor
 125      *
 126      * @param newObj true if this is being instantiated with a new
 127      * @param self   self reference
 128      * @param msg    error message
 129      *
 130      * @return NativeError instance
 131      */




  75 
  76     /** Message property name */
  77     @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE)
  78     public Object instMessage;
  79 
  80     /** ECMA 15.11.4.2 Error.prototype.name */
  81     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
  82     public Object name;
  83 
  84     /** ECMA 15.11.4.3 Error.prototype.message */
  85     @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
  86     public Object message;
  87 
  88     /** Nashorn extension: underlying exception */
  89     @Property(attributes = Attribute.NOT_ENUMERABLE)
  90     public Object nashornException;
  91 
  92     // initialized by nasgen
  93     private static PropertyMap $nasgenmap$;
  94 




  95     @SuppressWarnings("LeakingThisInConstructor")
  96     private NativeError(final Object msg, final ScriptObject proto, final PropertyMap map) {
  97         super(proto, map);
  98         if (msg != UNDEFINED) {
  99             this.instMessage = JSType.toString(msg);
 100         } else {
 101             this.delete(NativeError.MESSAGE, false);
 102         }
 103         initException(this);
 104     }
 105 
 106     NativeError(final Object msg, final Global global) {
 107         this(msg, global.getErrorPrototype(), $nasgenmap$);
 108     }
 109 
 110     private NativeError(final Object msg) {
 111         this(msg, Global.instance());
 112     }
 113 
 114     @Override
 115     public String getClassName() {
 116         return "Error";
 117     }
 118 
 119     /**
 120      * ECMA 15.11.2 The Error Constructor
 121      *
 122      * @param newObj true if this is being instantiated with a new
 123      * @param self   self reference
 124      * @param msg    error message
 125      *
 126      * @return NativeError instance
 127      */