aboutsummaryrefslogtreecommitdiffhomepage
path: root/content.js
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-12-13 21:32:57 -0500
committerAjay Ramachandran <[email protected]>2019-12-13 21:32:57 -0500
commitb34e6076e40793fd56a847b551e4fb6d9c508f2e (patch)
tree4cb1b31bcedc10fcc9bfc90fcd633032062b63b0 /content.js
parent226c5d601c7ccc4e81ec8ecc2a30ea7e15367a0e (diff)
downloadSponsorBlock-b34e6076e40793fd56a847b551e4fb6d9c508f2e.tar.gz
SponsorBlock-b34e6076e40793fd56a847b551e4fb6d9c508f2e.zip
Moved error message handling to a util file and added a link to the status site.
Diffstat (limited to 'content.js')
-rw-r--r--content.js19
1 files changed, 3 insertions, 16 deletions
diff --git a/content.js b/content.js
index 80ee0fea..c509e6cc 100644
--- a/content.js
+++ b/content.js
@@ -980,14 +980,8 @@ function vote(type, UUID, skipNotice) {
skipNotice.addNoticeInfoMessage.bind(skipNotice)(chrome.i18n.getMessage("voteFail"))
skipNotice.resetVoteButtonInfo.bind(skipNotice)();
} else if (response.successType == -1) {
- if (response.statusCode == 502) {
- skipNotice.addNoticeInfoMessage.bind(skipNotice)(chrome.i18n.getMessage("serverDown"))
- skipNotice.resetVoteButtonInfo.bind(skipNotice)();
- } else {
- //failure: unknown error
- skipNotice.addNoticeInfoMessage.bind(skipNotice)(chrome.i18n.getMessage("connectionError") + response.statusCode);
- skipNotice.resetVoteButtonInfo.bind(skipNotice)();
- }
+ skipNotice.addNoticeInfoMessage.bind(skipNotice)(getErrorMessage(response.statusCode))
+ skipNotice.resetVoteButtonInfo.bind(skipNotice)();
}
}
}
@@ -1101,14 +1095,7 @@ function sendSubmitMessage(){
document.getElementById("submitButton").style.animation = "unset";
document.getElementById("submitImage").src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker256px.png");
- if([400, 429, 409, 502, 0].includes(response.statusCode)) {
- //treat them the same
- if (response.statusCode == 503) response.statusCode = 502;
-
- alert(chrome.i18n.getMessage(response.statusCode + "") + " " + chrome.i18n.getMessage("errorCode") + response.statusCode);
- } else {
- alert(chrome.i18n.getMessage("connectionError") + response.statusCode);
- }
+ alert(getErrorMessage(response.statusCode));
}
}
});