From 88619145d816fdd3248b5c071bdd8059ab3219cb Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Wed, 21 Jul 2021 14:57:33 -0700 Subject: [PATCH] Group 'Source not installed' cases in library update error log (#5589) --- .../kanade/tachiyomi/data/library/LibraryUpdateService.kt | 3 +++ .../main/java/eu/kanade/tachiyomi/source/SourceManager.kt | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 2e4f19f23..0cc8148f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -316,6 +316,9 @@ class LibraryUpdateService( } catch (e: Throwable) { val errorMessage = if (e is NoChaptersException) { getString(R.string.no_chapters_error) + } else if (e is SourceManager.SourceNotInstalledException) { + // failedUpdates will already have the source, don't need to copy it into the message + getString(R.string.loader_not_implemented_error) } else { e.message } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt index 89ae2e951..4f8657b91 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt @@ -70,8 +70,11 @@ open class SourceManager(private val context: Context) { return name } - private fun getSourceNotInstalledException(): Exception { - return Exception(context.getString(R.string.source_not_installed, id.toString())) + private fun getSourceNotInstalledException(): SourceNotInstalledException { + return SourceNotInstalledException(id) } } + + inner class SourceNotInstalledException(val id: Long) : + Exception(context.getString(R.string.source_not_installed, id.toString())) }