diff options
author | Ajay Ramachandran <[email protected]> | 2019-12-13 21:32:57 -0500 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2019-12-13 21:32:57 -0500 |
commit | b34e6076e40793fd56a847b551e4fb6d9c508f2e (patch) | |
tree | 4cb1b31bcedc10fcc9bfc90fcd633032062b63b0 /content.js | |
parent | 226c5d601c7ccc4e81ec8ecc2a30ea7e15367a0e (diff) | |
download | SponsorBlock-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.js | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -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)); } } }); |