couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [42/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf
Date Tue, 01 Apr 2014 08:52:47 GMT
COUCHDB-1381 - Don't call alert() from jquery.couch.js

jquery.couch.js is a javascript library and should not assume it's
running inside a browser. Particularly, it should not call
alert(). Instead it should throw an exception.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/commit/ce9e39cb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/tree/ce9e39cb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/diff/ce9e39cb

Branch: refs/heads/import-master
Commit: ce9e39cb01488150c694f6fe6f5e554c3748c08d
Parents: 428e874
Author: Sam Bisbee <sam@sbisbee.com>
Authored: Sat Feb 18 15:20:36 2012 +0000
Committer: Alexander Shorin <kxepal@gmail.com>
Committed: Sat Feb 18 15:20:36 2012 +0000

----------------------------------------------------------------------
 jquery.couch.js | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/blob/ce9e39cb/jquery.couch.js
----------------------------------------------------------------------
diff --git a/jquery.couch.js b/jquery.couch.js
index b3a24f0..34255bb 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -151,7 +151,7 @@
           } else if (options.error) {
             options.error(req.status, resp.error, resp.reason);
           } else {
-            alert("An error occurred getting session info: " + resp.reason);
+            throw "An error occurred getting session info: " + resp.reason;
           }
         }
       });
@@ -215,7 +215,7 @@
           } else if (options.error) {
             options.error(req.status, resp.error, resp.reason);
           } else {
-            alert("An error occurred logging in: " + resp.reason);
+            throw 'An error occurred logging in: ' + resp.reason;
           }
         }
       });
@@ -243,7 +243,7 @@
           } else if (options.error) {
             options.error(req.status, resp.error, resp.reason);
           } else {
-            alert("An error occurred logging out: " + resp.reason);
+            throw 'An error occurred logging out: ' + resp.reason;
           }
         }
       });
@@ -268,9 +268,7 @@
             rawDocs[doc._id].rev == doc._rev) {
           // todo: can we use commonjs require here?
           if (typeof Base64 == "undefined") {
-            alert("please include /_utils/script/base64.js in the page for " +
-                  "base64 support");
-            return false;
+            throw 'Base64 support not found.';
           } else {
             doc._attachments = doc._attachments || {};
             doc._attachments["rev-"+doc._rev.split("-")[0]] = {
@@ -556,7 +554,7 @@
               }
             });
           } else {
-            alert("Please provide an eachApp function for allApps()");
+            throw 'Please provide an eachApp function for allApps()';
           }
         },
 
@@ -650,7 +648,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert("The document could not be saved: " + resp.reason);
+                throw "The document could not be saved: " + resp.reason;
               }
             }
           });
@@ -748,7 +746,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert("The document could not be copied: " + resp.reason);
+                throw "The document could not be copied: " + resp.reason;
               }
             }
           });
@@ -1012,7 +1010,7 @@
           if (options.error) {
             options.error(req.status, req, e);
           } else {
-            alert(errorMessage + ": " + e);
+            throw errorMessage + ': ' + e;
           }
           return;
         }
@@ -1027,7 +1025,7 @@
                         errorMessage, resp && resp.reason || "no response",
                         reqDuration);
         } else {
-          alert(errorMessage + ": " + resp.reason);
+          throw errorMessage + ": " + resp.reason;
         }
       }
     }, obj), ajaxOptions));


Mime
View raw message