2003/11/29 03:06:08
[org.ibex.core.git] / src / org / xwt / Box.java
index ebd3d85..2adac17 100644 (file)
@@ -364,7 +364,7 @@ public final class Box extends JSScope {
     public Enumeration keys() { throw new Error("you cannot apply for..in to a " + this.getClass().getName()); }
 
     protected boolean isTrappable() { return true; }
-    public Object get(Object name) {
+    public Object get(Object name) throws JSExn {
         if (name instanceof Number)
             return redirect == null ? null : redirect == this ? getChild(toInt(name)) : redirect.get(name);
 
@@ -412,7 +412,7 @@ public final class Box extends JSScope {
         throw new Error("unreachable"); // unreachable
     }
 
-    public void put(Object name, Object value) {
+    public void put(Object name, Object value) throws JSExn {
         if (name instanceof Number) { put(toInt(name), value); return; }
         //#switch(name)
         case "text": CHECKSET_STRING(text); MARK_RESIZE; dirty();
@@ -670,7 +670,7 @@ public final class Box extends JSScope {
         putAndTriggerTraps("childremoved", b);
     }
     
-    public void put(int i, Object value) {
+    public void put(int i, Object value) throws JSExn {
         if (i < 0) return;
             
         if (value != null && !(value instanceof Box)) {
@@ -727,6 +727,25 @@ public final class Box extends JSScope {
         }
     }
 
+
+    public final void putAndTriggerTraps(Object key, Object value) {
+        try {
+            super.putAndTriggerTraps(key, value);
+        } catch (JSExn jse) {
+            Log.logJS("attempt to put value " + value + " to key " + key + " on a box triggered a trap which threw:");
+            Log.logJS(jse);
+        }
+    }
+
+    public final Object getAndTriggerTraps(Object key) {
+        try {
+            return super.getAndTriggerTraps(key);
+        } catch (JSExn jse) {
+            Log.logJS("attempt to get key " + key + " on a box triggered a trap which threw:");
+            Log.logJS(jse);
+            return null;
+        }
+    }
 }