Update jsfiddles to have more helpful error messages when there is no connection when logging in.

pull/10/head
Kegan Dougal 2014-09-08 14:53:58 -07:00
parent 5236de5b03
commit 544691ab05
4 changed files with 30 additions and 5 deletions

View File

@ -19,7 +19,12 @@ $('.login').live('click', function() {
showLoggedIn(data); showLoggedIn(data);
}, },
error: function(err) { 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);
} }
}); });
}); });

View File

@ -58,7 +58,12 @@ $('.login').live('click', function() {
showLoggedIn(data); showLoggedIn(data);
}, },
error: function(err) { 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);
} }
}); });
}); });

View File

@ -20,7 +20,12 @@ $('.register').live('click', function() {
showLoggedIn(data); showLoggedIn(data);
}, },
error: function(err) { 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); showLoggedIn(data);
}, },
error: function(err) { 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);
} }
}); });
}; };

View File

@ -28,7 +28,12 @@ $('.login').live('click', function() {
showLoggedIn(data); showLoggedIn(data);
}, },
error: function(err) { 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);
} }
}); });
}); });