mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 06:27:14 +03:00
Fix errors when response fails
This commit is contained in:
@@ -618,7 +618,7 @@ function sponsorsLookup(id: string) {
|
|||||||
videoID: id,
|
videoID: id,
|
||||||
categories
|
categories
|
||||||
}).then(async (response: FetchResponse) => {
|
}).then(async (response: FetchResponse) => {
|
||||||
if (response.ok) {
|
if (response?.ok) {
|
||||||
let recievedSegments: SponsorTime[] = JSON.parse(response.responseText);
|
let recievedSegments: SponsorTime[] = JSON.parse(response.responseText);
|
||||||
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));
|
||||||
@@ -662,7 +662,7 @@ function sponsorsLookup(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sponsorLookupRetries = 0;
|
sponsorLookupRetries = 0;
|
||||||
} else if (response.status === 404) {
|
} else if (response?.status === 404) {
|
||||||
sponsorDataFound = false;
|
sponsorDataFound = false;
|
||||||
|
|
||||||
//check if this video was uploaded recently
|
//check if this video was uploaded recently
|
||||||
|
|||||||
Reference in New Issue
Block a user