Pman.Request.js
[Pman.Core] / Pman.Request.js
index 634fea6..4cb2ebd 100644 (file)
@@ -34,8 +34,9 @@ Pman.Request = function(config){
 }
 
 Roo.extend(Pman.Request, Roo.data.Connection, {
-    
+    // private
     processResponse : function(response) {
+        // convert the Roo Connection response into JSON data.
         
         var res = '';
         try {
@@ -49,7 +50,11 @@ Roo.extend(Pman.Request, Roo.data.Connection, {
             }
             
         } catch(e) {
-            res = { success : false,  errorMsg : response.responseText, errors : true };
+            res = { success : false,  errorMsg : response.responseText || Roo.encode(response), errors : true };
+        }
+        //Roo.log(response.responseText);
+        if (!res.success && !res.errorMsg) {
+            res .errorMsg = Roo.encode(response);
         }
         return res;
     },
@@ -82,9 +87,12 @@ Roo.extend(Pman.Request, Roo.data.Connection, {
         response.argument = options ? options.argument : null;
         this.fireEvent("requestexception", this, response, options, e);
         var res = Roo.callback(options.failure, options.scope, [response, options]);
+        
         if (res !== true) {
+            var decode = this.processResponse(response);
+                
             Roo.MessageBox.hide(); // hide any existing messages..
-            Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : "Error Sending");
+            Roo.MessageBox.alert("Error", "Error Sending" + decode.errorMsg);
         }
     }
 });
\ No newline at end of file