Skip to content

Commit 5251f37

Browse files
committed
🐛 Fix crash when downloading webtoon (again)
1 parent 1741b5f commit 5251f37

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/modules/webtoon/webtoon/download-manager.service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,17 @@ export class DownloadManagerService{
9797
if(!this.downloadQueue.getCurrentDownload()) // If current download is cleared, stop downloading
9898
break;
9999
this.downloadGatewayService.onDownloadProgress(i / epList.length * 100);
100-
const epImageLinks: string[] = await this.webtoonParserService.getEpisodeLinks(this.downloadQueue.getCurrentDownload(), epList[i]);
100+
let epImageLinks: string[];
101+
let error = false;
102+
while(!error){
103+
try{
104+
epImageLinks = await this.webtoonParserService.getEpisodeLinks(this.downloadQueue.getCurrentDownload(), epList[i]);
105+
error = false;
106+
}catch (_: any){
107+
this.logger.warn(`Error fetching episode ${epList[i].number} of ${this.downloadQueue.getCurrentDownload().title}. Retrying...`);
108+
error = true;
109+
}
110+
}
101111
let downloaded = false;
102112
let episodeData: EpisodeDataModel;
103113
while(!downloaded){

0 commit comments

Comments
 (0)