From 8b65fd57519faa8119fca97febf90c5e8590c4a6 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 28 Dec 2023 16:33:54 -0500 Subject: [PATCH] Minor exception message cleanup --- .../eu/kanade/tachiyomi/data/backup/create/BackupCreator.kt | 5 ++--- .../eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt | 2 +- .../kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreator.kt index 4065197c9..695e74759 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreator.kt @@ -73,10 +73,9 @@ class BackupCreator( UniFile.fromUri(context, uri) } ) - ?: throw Exception(context.stringResource(MR.strings.create_backup_file_error)) - if (!file.isFile) { - throw IllegalStateException("Failed to get handle on a backup file") + if (file == null || !file.isFile) { + throw IllegalStateException(context.stringResource(MR.strings.create_backup_file_error)) } val databaseManga = getFavorites.await() diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index c40d78157..eccf66cd6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -304,7 +304,7 @@ internal object ExtensionLoader { when (val obj = Class.forName(it, false, classLoader).getDeclaredConstructor().newInstance()) { is Source -> listOf(obj) is SourceFactory -> obj.createSources() - else -> throw Exception("Unknown source class type! ${obj.javaClass}") + else -> throw Exception("Unknown source class type: ${obj.javaClass}") } } catch (e: Throwable) { logcat(LogPriority.ERROR, e) { "Extension load error: $extName ($it)" } diff --git a/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt b/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt index ac396fadf..3a079953b 100644 --- a/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -473,4 +473,4 @@ abstract class HttpSource : CatalogueSource { override fun getFilterList() = FilterList() } -class LicensedMangaChaptersException : Exception("Licensed - No chapters to show") +class LicensedMangaChaptersException : RuntimeException()