Readd 'Could not create admin.' to the beginning of the error message

was removed in b63ff1b50b7bde0c8f1f95988d076dda63f41fed


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

Branch: refs/heads/import-master
Commit: 659b4024f5f2dc10f80d5ccd568459f39a40e187
Parents: 50731ba
Author: Robert Kowalski <r...@kowalski.gd>
Authored: Tue Mar 25 22:05:19 2014 +0100
Committer: Garren Smith <garren.sm...@gmail.com>
Committed: Wed Mar 26 10:17:51 2014 +0200

----------------------------------------------------------------------
 app/addons/auth/resources.js | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/659b4024/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/resources.js b/app/addons/auth/resources.js
index edfd708..ba3a438 100644
--- a/app/addons/auth/resources.js
+++ b/app/addons/auth/resources.js
@@ -20,7 +20,7 @@ function (app, FauxtonAPI, CouchdbSession) {
 
   var Auth = new FauxtonAPI.addon();
 
-  var promiseErrorHandler = function (xhr, type, msg) {
+  var errorHandler = function (xhr, type, msg) {
     msg = xhr;
     if (arguments.length === 3) {
       msg = xhr.responseJSON.reason;
@@ -72,7 +72,8 @@ function (app, FauxtonAPI, CouchdbSession) {
           passwordsNotMatch:  'Passwords do not match.',
           loggedIn: 'You have been logged in.',
           adminCreated: 'CouchDB admin created',
-          changePassword: 'Your password has been updated.'
+          changePassword: 'Your password has been updated.',
+          adminCreationFailedPrefix: 'Could not create admin.'
         }, options.messages);
     },
 
@@ -245,7 +246,14 @@ function (app, FauxtonAPI, CouchdbSession) {
         }
       });
 
-      promise.fail(promiseErrorHandler);
+      promise.fail(function (xhr, type, msg) {
+        msg = xhr;
+        if (arguments.length === 3) {
+          msg = xhr.responseJSON.reason;
+        }
+        msg = FauxtonAPI.session.messages.adminCreationFailedPrefix + ' ' + 
msg;
+        errorHandler(msg);
+      });
     }
 
   });
@@ -279,7 +287,7 @@ function (app, FauxtonAPI, CouchdbSession) {
         FauxtonAPI.navigate('/');
       });
 
-      promise.fail(promiseErrorHandler);
+      promise.fail(errorHandler);
     }
 
   });
@@ -306,7 +314,7 @@ function (app, FauxtonAPI, CouchdbSession) {
         that.$('#password-confirm').val('');
       });
 
-      promise.fail(promiseErrorHandler);
+      promise.fail(errorHandler);
     }
   });
 

Reply via email to