diff --git a/app/src/main/java/eu/kanade/mangafeed/data/sync/UpdateMangaSyncService.java b/app/src/main/java/eu/kanade/mangafeed/data/sync/UpdateMangaSyncService.java index 4733ee429..0f2ce8ee2 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/sync/UpdateMangaSyncService.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/sync/UpdateMangaSyncService.java @@ -61,7 +61,12 @@ public class UpdateMangaSyncService extends Service { MangaSyncService sync = syncManager.getSyncService(mangaSync.sync_id); subscriptions.add(Observable.defer(() -> sync.update(mangaSync)) - .flatMap(response -> db.insertMangaSync(mangaSync).createObservable()) + .flatMap(response -> { + if (response.isSuccessful()) { + return db.insertMangaSync(mangaSync).createObservable(); + } + return Observable.error(new Exception("Could not update MAL")); + }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/manga/myanimelist/MyAnimeListPresenter.java b/app/src/main/java/eu/kanade/mangafeed/ui/manga/myanimelist/MyAnimeListPresenter.java index 85a481e27..79d6a7a55 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/manga/myanimelist/MyAnimeListPresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/manga/myanimelist/MyAnimeListPresenter.java @@ -113,8 +113,9 @@ public class MyAnimeListPresenter extends BasePresenter { manga.manga_id = this.manga.id; add(myAnimeList.bind(manga) .flatMap(response -> { - if (response.code() == 200 || response.code() == 201) + if (response.isSuccessful()) { return Observable.just(manga); + } return Observable.error(new Exception("Could not add manga")); }) .flatMap(manga2 -> db.insertMangaSync(manga2).createObservable())