fix date calc
[gitlive] / XObject.js
index 7ed3d1c..8f1e30d 100644 (file)
@@ -197,8 +197,21 @@ XObject.prototype = {
            
         }
         if (!this.el && typeof(this.xtype) == 'object') {
+            
             XObject.log("obj?"  + XObject.keys(this.config).join(','));
-            this.el = new (this.xtype)(this.config);
+            try {
+                this.el = new (this.xtype)(this.config);
+            } catch(e) {
+                print(JSON.stringify(e,null,4));
+                print(JSON.stringify(this.config,null,4));
+                print(e.stack);
+                
+                 throw {
+                    name: "ArgumentError", 
+                    message :"Error creating object from xtype(object)"
+                 };
+            }
+              
       
         }
         //print(this.el);
@@ -258,7 +271,7 @@ XObject.prototype = {
          //   XObject.registry[o.xnsid][o.id] = this;
         //}
         
-        var type = this.xtype.type ? GObject.type_name(this.xtype.type) : '';
+        var type = this.xtype && this.xtype.type ? GObject.type_name(this.xtype.type) : '';
         XObject.log("add children to " + type);
         
         var _this=this;
@@ -381,6 +394,13 @@ XObject.prototype = {
         var _li = XObject.createDelegate(fn,this);
         // private listeners that are not copied to GTk.
         
+               if (!this.el) {
+                       print('missing el?');
+                       print(fn);
+                       print(JSON.stringify(this.cfg));
+                       }
+               
+               
         if (typeof(Seed) != 'undefined') {
           //   Seed.print(typeof(_li));
             this.el.signal[sig].connect(_li);
@@ -748,6 +768,7 @@ XObject.extend(XObject,
             }
             
             XObject.log("TRYING BASE OBJECT : " + gname);
+                         
             // in the situation where we have been called and there is a base object
             // defining the behavior..
             // then we should copy the prototypes from the base object into this..