couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [13/50] [abbrv] git commit: Display a notification if save doc fails
Date Mon, 11 Feb 2013 11:12:15 GMT
Display a notification if save doc fails


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

Branch: refs/heads/fauxton
Commit: 9a0c72f915eda03412e0896d53ff4af81d281ca1
Parents: 825e01d
Author: Mike Wallace <mikewallace1979@googlemail.com>
Authored: Sun Jan 20 21:55:02 2013 +0000
Committer: Mike Wallace <mikewallace1979@googlemail.com>
Committed: Mon Jan 21 13:29:34 2013 +0000

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9a0c72f9/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index b530c82..f6ce4e9 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -384,7 +384,16 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
         json = JSON.parse(this.editor.getValue());
         this.model.set(json);
         notification = FauxtonAPI.addNotification({msg: "Saving document."});
-        this.model.save();
+        this.model.save().error(
+          function(xhr) {
+            var responseText = JSON.parse(xhr.responseText).reason;
+            notification = FauxtonAPI.addNotification({
+              msg: "Save failed: " + responseText,
+              type: "error",
+              clear: true
+            });
+          }
+        );
       } else {
         notification = FauxtonAPI.addNotification({
           msg: "Please fix the JSON errors and try again.",


Mime
View raw message