Handle anime completion retry errors
This commit is contained in:
@@ -14,9 +14,14 @@ export const completeAnime = async (episodeNumber: number): Promise<void> => {
|
|||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
state.episode.completionSent = false;
|
state.episode.completionSent = false;
|
||||||
|
console.error(`failed to complete anime: status ${res.status}`);
|
||||||
if (state.episode.completionAttempts < 2) {
|
if (state.episode.completionAttempts < 2) {
|
||||||
state.episode.completionAttempts++;
|
state.episode.completionAttempts++;
|
||||||
setTimeout(() => completeAnime(episodeNumber), 1000);
|
setTimeout(() => {
|
||||||
|
completeAnime(episodeNumber).catch((error) => {
|
||||||
|
console.error("failed to retry anime completion:", error);
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -34,7 +39,11 @@ export const completeAnime = async (episodeNumber: number): Promise<void> => {
|
|||||||
console.error("failed to complete anime:", error);
|
console.error("failed to complete anime:", error);
|
||||||
if (state.episode.completionAttempts < 2) {
|
if (state.episode.completionAttempts < 2) {
|
||||||
state.episode.completionAttempts++;
|
state.episode.completionAttempts++;
|
||||||
setTimeout(() => completeAnime(episodeNumber), 1000);
|
setTimeout(() => {
|
||||||
|
completeAnime(episodeNumber).catch((retryError) => {
|
||||||
|
console.error("failed to retry anime completion:", retryError);
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user