Skip to content

Commit

Permalink
Surface exceptions when fetching pages properly (fixes #5377)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkon committed Jun 12, 2021
1 parent 8deca3b commit 8d25ce7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ChapterLoader(
}
}
.observeOn(AndroidSchedulers.mainThread())
.doOnError { chapter.state = ReaderChapter.State.Error(it) }
.doOnNext { pages ->
if (pages.isEmpty()) {
throw Exception(context.getString(R.string.page_list_empty_error))
Expand All @@ -61,7 +62,6 @@ class ChapterLoader(
}
}
.toCompletable()
.doOnError { chapter.state = ReaderChapter.State.Error(it) }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class HttpPageLoader(
override fun getPages(): Observable<List<ReaderPage>> {
return Observable.fromCallable { chapterCache.getPageListFromCache(chapter.chapter) }
.onErrorResumeNext { source.fetchPageList(chapter.chapter) }
.onErrorReturn { emptyList() }
.map { pages ->
pages.mapIndexed { index, page ->
// Don't trust sources and use our own indexing
Expand Down

0 comments on commit 8d25ce7

Please sign in to comment.