refactor: enhance error handling in fetchExternalMangaData method
This commit is contained in:
parent
533e7ce21a
commit
7df2ea1b7a
@ -71,12 +71,28 @@ public class MangaUpdateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MangaDataDTO fetchExternalMangaData(Manga manga) {
|
private MangaDataDTO fetchExternalMangaData(Manga manga) {
|
||||||
|
Exception fetchException = null;
|
||||||
|
|
||||||
if (nonNull(manga.getAniListId())) {
|
if (nonNull(manga.getAniListId())) {
|
||||||
return aniListService.getMangaDataById(manga.getAniListId());
|
try {
|
||||||
|
return aniListService.getMangaDataById(manga.getAniListId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Failed to fetch manga data from AniList for Manga ID {}", manga.getId(), e);
|
||||||
|
fetchException = e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonNull(manga.getMalId())) {
|
if (nonNull(manga.getMalId())) {
|
||||||
return myAnimeListService.getMangaDataById(manga.getMalId());
|
try {
|
||||||
|
return myAnimeListService.getMangaDataById(manga.getMalId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Failed to fetch manga data from MyAnimeList for Manga ID {}", manga.getId(), e);
|
||||||
|
fetchException = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonNull(fetchException)) {
|
||||||
|
throw (RuntimeException) fetchException;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user