mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-13 02:14:23 +01:00
Properly handle server error
This commit is contained in:
parent
ae690f0c65
commit
a50f030a3b
1 changed files with 3 additions and 2 deletions
|
@ -605,13 +605,14 @@ function sponsorsLookup(id: string, channelIDPromise?) {
|
|||
categories
|
||||
}).then(async (response: Response) => {
|
||||
if (response.status === 200) {
|
||||
sponsorDataFound = true;
|
||||
|
||||
let recievedSegments: SponsorTime[] = await response.json();
|
||||
if (!recievedSegments.length) {
|
||||
console.error("[SponsorBlock] Server returned malformed response: " + JSON.stringify(recievedSegments));
|
||||
return;
|
||||
}
|
||||
|
||||
sponsorDataFound = true;
|
||||
|
||||
// Check if any old submissions should be kept
|
||||
if (sponsorTimes !== null) {
|
||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue