From 89142c54c0fdadeb027a35326fd5b27dc2c46d8c Mon Sep 17 00:00:00 2001 From: Jeena Date: Thu, 22 May 2014 21:29:39 +0200 Subject: [PATCH] better error message on login with wrong server address, fixes #15 --- js/App.js | 2 +- js/OwnCloud.js | 6 +++++- js/Pond.js | 6 +++++- js/TinyTinyRSS.js | 6 +++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/js/App.js b/js/App.js index 86eef5b..f5f0db6 100644 --- a/js/App.js +++ b/js/App.js @@ -186,7 +186,7 @@ App.prototype.gotUnreadFeeds = function(new_articles) { } } catch (e) { - alert("Reached maximum memory by app" + e.name + " " +e.message +". We will keep working in anycase with:" + localStorage.unread_articles.length); + alert("Reached maximum memory by app " + e.name + " " + e.message + ". We will keep working in anycase with: " + localStorage.unread_articles.length); } this.populateList(); } diff --git a/js/OwnCloud.js b/js/OwnCloud.js index 25519eb..8272ca6 100644 --- a/js/OwnCloud.js +++ b/js/OwnCloud.js @@ -241,7 +241,11 @@ OwnCloud.login = function(server_url, user, password, callback) { if(xhr.status == 200) { callback(JSON.parse(xhr.responseText)) } else { - alert("error: " + xhr.status + " " + xhr.statusText) + if(xhr.status == 0) { + alert("Something went wrong, please check your credentials and the server address") + } else { + alert("error: " + xhr.status + " " + xhr.statusText); + } } } } diff --git a/js/Pond.js b/js/Pond.js index 7f4d429..e9eb049 100644 --- a/js/Pond.js +++ b/js/Pond.js @@ -215,7 +215,11 @@ Pond.login = function(server_url, user, password, callback) { if(xhr.status == 201) { callback(JSON.parse(xhr.responseText)) } else { - alert("error: " + typeof(xhr.status) + " " + xhr.statusText + "\n\n" + xhr.responseText) + if(xhr.status == 0) { + alert("Something went wrong, please check your credentials and the server address") + } else { + alert("error: " + typeof(xhr.status) + " " + xhr.statusText + "\n\n" + xhr.responseText); + } } } } diff --git a/js/TinyTinyRSS.js b/js/TinyTinyRSS.js index 1fd2813..6405508 100644 --- a/js/TinyTinyRSS.js +++ b/js/TinyTinyRSS.js @@ -175,7 +175,11 @@ TinyTinyRSS.login = function(server_url, user, password, callback) { if(xhr.status == 200) { callback(JSON.parse(xhr.responseText).content) } else { - alert("error: " + xhr.status + " " + xhr.statusText) + if(xhr.status == 0) { + alert("Something went wrong, please check your credentials and the server address") + } else { + alert("error: " + xhr.status + " " + xhr.statusText) + } } } }