Author: lindner
Date: Wed Sep  3 03:15:45 2008
New Revision: 691561

URL: http://svn.apache.org/viewvc?rev=691561&view=rev
Log:
SHINDIG-566 | JSON RPC ResponseItem.getErrorCode() returns full object.  Patch 
from Adam Winer

Modified:
    incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
    
incubator/shindig/trunk/java/server/src/test/resources/endtoend/fetchPersonTest.xml

Modified: 
incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js?rev=691561&r1=691560&r2=691561&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js 
(original)
+++ incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js Wed 
Sep  3 03:15:45 2008
@@ -452,7 +452,10 @@
 
   this.processResponse = function(originalDataRequest, rawJson, error,
       errorMessage) {
+    var errorCode = error
+      ? JsonRpcContainer.translateHttpError("Error " + error['code'])
+      : null;
     return new opensocial.ResponseItem(originalDataRequest,
-        error ? null : this.processData(rawJson), error, errorMessage);
+        error ? null : this.processData(rawJson), errorCode, errorMessage);
   }
 };

Modified: 
incubator/shindig/trunk/java/server/src/test/resources/endtoend/fetchPersonTest.xml
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/server/src/test/resources/endtoend/fetchPersonTest.xml?rev=691561&r1=691560&r2=691561&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/server/src/test/resources/endtoend/fetchPersonTest.xml
 (original)
+++ 
incubator/shindig/trunk/java/server/src/test/resources/endtoend/fetchPersonTest.xml
 Wed Sep  3 03:15:45 2008
@@ -103,6 +103,25 @@
 
             // Send the request
             req.send(receivedData);
+          },
+
+          fetchPersonNotFound: function() {
+            var req = opensocial.newDataRequest();
+
+            // Request the "canonical" viewer
+            req.add(req.newFetchPersonRequest("not.a.real.id"), "bad");
+
+            function receivedData(response) {
+              assertTrue("No data error", response.hadError());
+              var dataItem = response.get("bad");
+              assertTrue("No data item error", dataItem.hadError());
+              assertEquals("Not a badRequest", "badRequest", 
dataItem.getErrorCode());
+              assertEquals("Not null data", null, dataItem.getData());
+              finished();
+            }
+
+            // Send the request
+            req.send(receivedData);
           }
         };
         


Reply via email to