mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-15 07:57:09 +03:00
Added better error messages to voting.
This commit is contained in:
@@ -100,12 +100,14 @@ function submitVote(type, UUID, callback) {
|
|||||||
} else if (xmlhttp.readyState == 4 && xmlhttp.status == 405) {
|
} else if (xmlhttp.readyState == 4 && xmlhttp.status == 405) {
|
||||||
//duplicate vote
|
//duplicate vote
|
||||||
callback({
|
callback({
|
||||||
successType: 0
|
successType: 0,
|
||||||
|
statusCode: xmlhttp.status
|
||||||
});
|
});
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
//error while connect
|
//error while connect
|
||||||
callback({
|
callback({
|
||||||
successType: -1
|
successType: -1,
|
||||||
|
statusCode: xmlhttp.status
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -710,8 +710,13 @@ function vote(type, UUID) {
|
|||||||
//failure: duplicate vote
|
//failure: duplicate vote
|
||||||
addLoadingInfo("It seems you've already voted before", UUID)
|
addLoadingInfo("It seems you've already voted before", UUID)
|
||||||
} else if (response.successType == -1) {
|
} else if (response.successType == -1) {
|
||||||
//failure: duplicate vote
|
if (response.statusCode == 502) {
|
||||||
addLoadingInfo("A connection error has occured.", UUID)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
8
popup.js
8
popup.js
@@ -750,8 +750,12 @@ function vote(type, UUID) {
|
|||||||
//failure: duplicate vote
|
//failure: duplicate vote
|
||||||
addVoteMessage("You have already voted this way before.", UUID)
|
addVoteMessage("You have already voted this way before.", UUID)
|
||||||
} else if (response.successType == -1) {
|
} else if (response.successType == -1) {
|
||||||
//failure: duplicate vote
|
if (response.statusCode == 502) {
|
||||||
addVoteMessage("A connection error has occured.", UUID)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user