summary refs log tree commit diff
path: root/jsfiddles/register_login
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-08 14:53:58 -0700
committerKegan Dougal <kegan@matrix.org>2014-09-08 14:54:10 -0700
commit544691ab05e7b5e5a265e7fda2aab0fae3a83097 (patch)
tree432c0870218dc178499b113e22e6d725f2123774 /jsfiddles/register_login
parentAdd slightly helpful advice on how to generate config if you don'y already ha... (diff)
downloadsynapse-544691ab05e7b5e5a265e7fda2aab0fae3a83097.tar.xz
Update jsfiddles to have more helpful error messages when there is no connection when logging in.
Diffstat (limited to 'jsfiddles/register_login')
-rw-r--r--jsfiddles/register_login/demo.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/jsfiddles/register_login/demo.js b/jsfiddles/register_login/demo.js
index 9595039173..fffa9e0551 100644
--- a/jsfiddles/register_login/demo.js
+++ b/jsfiddles/register_login/demo.js
@@ -20,7 +20,12 @@ $('.register').live('click', function() {
             showLoggedIn(data);
         },
         error: function(err) {
-            alert(JSON.stringify($.parseJSON(err.responseText)));  
+            var errMsg = "To try this, you need a home server running!";
+            var errJson = $.parseJSON(err.responseText);
+            if (errJson) {
+                errMsg = JSON.stringify(errJson);   
+            }
+            alert(errMsg);   
         }
     });
 });
@@ -36,7 +41,12 @@ var login = function(user, password) {
             showLoggedIn(data);
         },
         error: function(err) {
-            alert(JSON.stringify($.parseJSON(err.responseText)));  
+            var errMsg = "To try this, you need a home server running!";
+            var errJson = $.parseJSON(err.responseText);
+            if (errJson) {
+                errMsg = JSON.stringify(errJson);   
+            }
+            alert(errMsg);  
         }
     });  
 };