mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +03:00
Properly handle server error
This commit is contained in:
@@ -605,13 +605,14 @@ function sponsorsLookup(id: string, channelIDPromise?) {
|
|||||||
categories
|
categories
|
||||||
}).then(async (response: Response) => {
|
}).then(async (response: Response) => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
sponsorDataFound = true;
|
|
||||||
|
|
||||||
let recievedSegments: SponsorTime[] = await response.json();
|
let recievedSegments: SponsorTime[] = await response.json();
|
||||||
if (!recievedSegments.length) {
|
if (!recievedSegments.length) {
|
||||||
console.error("[SponsorBlock] Server returned malformed response: " + JSON.stringify(recievedSegments));
|
console.error("[SponsorBlock] Server returned malformed response: " + JSON.stringify(recievedSegments));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sponsorDataFound = true;
|
||||||
|
|
||||||
// Check if any old submissions should be kept
|
// Check if any old submissions should be kept
|
||||||
if (sponsorTimes !== null) {
|
if (sponsorTimes !== null) {
|
||||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user