diff --git a/background.js b/background.js index 446bf0bc..adb86553 100644 --- a/background.js +++ b/background.js @@ -100,12 +100,14 @@ function submitVote(type, UUID, callback) { } else if (xmlhttp.readyState == 4 && xmlhttp.status == 405) { //duplicate vote callback({ - successType: 0 + successType: 0, + statusCode: xmlhttp.status }); } else if (error) { //error while connect callback({ - successType: -1 + successType: -1, + statusCode: xmlhttp.status }); } }) diff --git a/content.js b/content.js index c9262d99..381a0932 100644 --- a/content.js +++ b/content.js @@ -710,8 +710,13 @@ function vote(type, UUID) { //failure: duplicate vote addLoadingInfo("It seems you've already voted before", UUID) } else if (response.successType == -1) { - //failure: duplicate vote - addLoadingInfo("A connection error has occured.", UUID) + if (response.statusCode == 502) { + addLoadingInfo("It seems the sever is down. Contact the dev immediately.", UUID) + } else { + //failure: unknown error + addLoadingInfo("A connection error has occured. Error code: " + response.statusCode, UUID) + } + } } }); diff --git a/popup.js b/popup.js index f4f1c6f8..37800636 100644 --- a/popup.js +++ b/popup.js @@ -750,8 +750,12 @@ function vote(type, UUID) { //failure: duplicate vote addVoteMessage("You have already voted this way before.", UUID) } else if (response.successType == -1) { - //failure: duplicate vote - addVoteMessage("A connection error has occured.", UUID) + if (response.statusCode == 502) { + addVoteMessage("It seems the sever is down. Contact the dev immediately.", UUID) + } else { + //failure: unknown error + addVoteMessage("A connection error has occured. Error code: " + response.statusCode, UUID) + } } } });