Skip to content

Commit

Permalink
fix(MangaDexDownloadService): throw error if chapter doesn't exist on…
Browse files Browse the repository at this point in the history
… MangaDex
  • Loading branch information
DevYukine committed Feb 12, 2024
1 parent 2850076 commit ab12500
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ public async Task<MangaDexDownloadResult> DownloadChapterPagesAsync(double chapt

var chapters = mangadexChapters.FindAll(x => x.Attributes.Chapter == chapterNumber.ToString());

var (chapterId, _, attributes, relationships) = chapters.First(c => c.Attributes.TranslatedLanguage == "en");
var englishChapter = chapters.FirstOrDefault(c => c.Attributes.TranslatedLanguage == "en");

if (englishChapter == null)
throw new Exception("No English chapter found");

var (chapterId, _, attributes, relationships) = englishChapter;

var chapterTitle = attributes.Title;
var uploadedAt = attributes.PublishAt;
int? volume = string.IsNullOrEmpty(attributes.Volume) ? null : int.Parse(attributes.Volume);
Expand Down

0 comments on commit ab12500

Please sign in to comment.