From 98fa25fb60bfe21341a40963bf6a36a2e5dc3fb5 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 5 Jan 2021 09:39:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/model/webBook/BookChapterList.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt index 1bba73ec1..445acd2d7 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt @@ -93,9 +93,12 @@ object BookChapterList { for (item in chapterDataList) { downloadToc( scope, item, book, bookSource, - tocRule, listRule, chapterList, chapterDataList + tocRule, listRule, chapterList, chapterDataList, + { + block.resume(finish(book, chapterList, reverse)) + } ) { - block.resume(finish(book, chapterList, reverse)) + throw it } } } @@ -114,7 +117,8 @@ object BookChapterList { listRule: String, chapterList: ArrayList, chapterDataList: ArrayList>, - onFinish: () -> Unit + onFinish: () -> Unit, + onError: (error: Throwable) -> Unit ) { Coroutine.async(scope = scope) { val nextBody = AnalyzeUrl( @@ -142,7 +146,7 @@ object BookChapterList { } } }.onError { - throw it + onError.invoke(it) } }