Author: lindner
Date: Fri Jun  5 23:50:16 2009
New Revision: 782172

URL: http://svn.apache.org/viewvc?rev=782172&view=rev
Log:
SHINDIG-1078 | throw Error("") should be used insead of throw "" in JavaScripts 
| patch from Márton Salomváry

Modified:
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-data/data.js
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js
    
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
    
incubator/shindig/trunk/features/src/main/javascript/features/xmlutil/xmlutil.js

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js?rev=782172&r1=782171&r2=782172&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js
 Fri Jun  5 23:50:16 2009
@@ -25,7 +25,7 @@
 opensocial.DataRequest.prototype.newUpdatePersonAppDataRequest = function(id,
     key, value) {
   if (id !== opensocial.IdSpec.PersonId.VIEWER) {
-    throw "Cannot update app data for person "  + id;
+    throw Error("Cannot update app data for person "  + id);
   }
   return this.newUpdatePersonAppDataRequest_09(key, value);
 }
@@ -38,7 +38,7 @@
 opensocial.DataRequest.prototype.newRemovePersonAppDataRequest = function(id,
     keys) {
   if (id !== opensocial.IdSpec.PersonId.VIEWER) {
-    throw "Cannot remove app data for person "  + id;
+    throw Error("Cannot remove app data for person "  + id);
   }
 
   return this.newRemovePersonAppDataRequest_09(keys);

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-data/data.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-data/data.js?rev=782172&r1=782171&r2=782172&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-data/data.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-data/data.js
 Fri Jun  5 23:50:16 2009
@@ -156,7 +156,7 @@
     handler = ns[this.tagParts[1]];
   }
   if (!handler) {
-    throw "Data handler undefined for " + this.tagName;
+    throw Error("Data handler undefined for " + this.tagName);
   }
   handler(this);
 };
@@ -231,7 +231,7 @@
  */
 opensocial.data.registerRequestDescriptor = function(requestDescriptor) {
   if (opensocial.data.requests_[requestDescriptor.key]) {
-    throw "Request already registered for " + requestDescriptor.key;
+    throw Error("Request already registered for " + requestDescriptor.key);
   }
   opensocial.data.requests_[requestDescriptor.key] = requestDescriptor;
 };
@@ -403,7 +403,7 @@
     }
     ns = opensocial.data.NSMAP[tagParts[0]] = {};
   } else if (ns[tagParts[1]]) {
-    throw 'Request handler ' + tagParts[1] + ' is already defined.';
+    throw Error('Request handler ' + tagParts[1] + ' is already defined.');
   }
 
   ns[tagParts[1]] = handler;

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js?rev=782172&r1=782171&r2=782172&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js
 Fri Jun  5 23:50:16 2009
@@ -320,7 +320,7 @@
   var result = tagFunction.call(null, node, data, ctx);
 
   if (!result && typeof(result) != "string") {
-    throw "Custom tag <" + ns + ":" + tag + "> failed to return anything.";
+    throw Error("Custom tag <" + ns + ":" + tag + "> failed to return 
anything.");
   }
 
   if (typeof(result) == "string") {

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js?rev=782172&r1=782171&r2=782172&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js
 Fri Jun  5 23:50:16 2009
@@ -75,7 +75,7 @@
 
 os.Container.disableAutoProcessing = function() {
   if (os.Container.processed_) {
-    throw "Document already processed.";
+    throw Error("Document already processed.");
   }
   os.Container.autoProcess_ = false;
 };

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js?rev=782172&r1=782171&r2=782172&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
 Fri Jun  5 23:50:16 2009
@@ -206,12 +206,12 @@
   if (tag) {
     var tagParts = tag.split(":");
     if (tagParts.length != 2) {
-      throw "Invalid tag name: " + tag;
+      throw Error("Invalid tag name: " + tag);
     }
     var nsObj = os.getNamespace(tagParts[0]);
     if (!nsObj) {
-      throw "Namespace not registered: " + tagParts[0] +
-          " while trying to define " + tag;
+      throw Error("Namespace not registered: " + tagParts[0] +
+          " while trying to define " + tag);
     }
     var template = os.compileXMLNode(node);
     nsObj[tagParts[1]] = os.createTemplateCustomTag(template);

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/xmlutil/xmlutil.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/xmlutil/xmlutil.js?rev=782172&r1=782171&r2=782172&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/xmlutil/xmlutil.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/xmlutil/xmlutil.js
 Fri Jun  5 23:50:16 2009
@@ -37,7 +37,7 @@
     opensocial.xmlutil.parser_ = opensocial.xmlutil.parser_ || new DOMParser();
     var doc = opensocial.xmlutil.parser_.parseFromString(str, "text/xml");
     if (doc.firstChild && doc.firstChild.tagName == 'parsererror') {
-      throw doc.firstChild.firstChild.nodeValue;
+      throw Error(doc.firstChild.firstChild.nodeValue);
     }
     return doc;
   } else if (typeof(ActiveXObject) != "undefined") {
@@ -45,11 +45,11 @@
     doc.validateOnParse = false;
     doc.loadXML(str);
     if (doc.parseError && doc.parseError.errorCode) {
-      throw doc.parseError.reason;
+      throw Error(doc.parseError.reason);
     }
     return doc;
   }
-  throw "No XML parser found in this browser.";
+  throw Error("No XML parser found in this browser.");
 };
 
 
@@ -139,4 +139,4 @@
   return "<!DOCTYPE root [" + opensocial.xmlutil.ENTITIES +
       "]><root xml:space=\"preserve\"" +
       namespaces + ">" + xml + "</root>";
-};
\ No newline at end of file
+};


Reply via email to