Author: damoxc

Revision: 5180

Log:
        change the "ready" event to "connected" and fix the failure event 
handler

Diff:
Modified: trunk/deluge/ui/web/js/Deluge.Client.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Client.js     2009-04-27 12:53:58 UTC (rev 
5179)
+++ trunk/deluge/ui/web/js/Deluge.Client.js     2009-04-27 12:55:42 UTC (rev 
5180)
@@ -43,11 +43,11 @@
             this.addEvents(
                 // raw events
                 /**
-                 * @event ready
+                 * @event connected
                  * Fires when the client has retrieved the list of methods 
from the server.
                  * @param {Ext.ux.util.RpcClient} this
                  */
-                 'ready'
+                 'connected'
             );
             this.reloadMethods();
         },
@@ -85,14 +85,19 @@
             });
         },
         
-        _onFailure: function(response, options) {
-            if (response.status == 500) {
-                //error
-            }
+        _onFailure: function(response, requestOptions) {
+            var options = requestOptions.options;
             errorObj = {
-                id: options.options.id
+                id: options.id,
+                result: null,
+                error: 'HTTP' + response.status
+            }            
+            if (Ext.type(options.failure) != 'function') return;
+            if (options.scope) {
+                options.failure.call(options.scope, responseObj.error, 
responseObj, response);
+            } else {
+                options.failure(responseObj.error, responseObj, response);
             }
-            //alert(Ext.encode(errorObj));
         },
         
         _onSuccess: function(response, requestOptions) {
@@ -161,7 +166,7 @@
             }
             
             this._components = Ext.keys(components);
-            this.fireEvent('ready', this);
+            this.fireEvent('connected', this);
         }
     });
 })();



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to