diff --git a/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt b/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt index a69bcfcbe..7169c9e9b 100644 --- a/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt +++ b/app/src/main/java/eu/kanade/presentation/util/ExceptionFormatter.kt @@ -3,6 +3,7 @@ package eu.kanade.presentation.util import android.content.Context import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.network.HttpException +import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException import tachiyomi.data.source.NoResultsException import tachiyomi.domain.source.model.SourceNotInstalledException @@ -13,6 +14,7 @@ val Throwable.formattedMessage: String is NoResultsException -> return getString(R.string.no_results_found) is SourceNotInstalledException -> return getString(R.string.loader_not_implemented_error) is HttpException -> return "$message: ${getString(R.string.http_error_hint)}" + is LicensedMangaChaptersException -> return getString(R.string.licensed_manga_chapters_error) } return when (val className = this::class.simpleName) { "Exception", "IOException" -> message ?: className diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt index 9c699f535..35a9ea598 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt @@ -106,10 +106,10 @@ class BackupManager( UniFile.fromUri(context, uri) } ) - ?: throw Exception("Couldn't create backup file") + ?: throw Exception(context.getString(R.string.create_backup_file_error)) if (!file.isFile) { - throw IllegalStateException("Failed to get handle on file") + throw IllegalStateException("Failed to get handle on a backup file") } val byteArray = parser.encodeToByteArray(BackupSerializer, backup) diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 7f8c138f3..8560883ad 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -495,6 +495,7 @@ Backup failed Storage permissions not granted No library entries to back up + Couldn\'t create a backup file Backup/restore may not function properly if MIUI Optimization is disabled. Restore is already in progress Restoring backup @@ -608,6 +609,7 @@ No results found Check website in WebView + Licensed - No chapters to show Local source Other Last used 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 f9e616dcd..c4529f4b4 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 @@ -215,7 +215,7 @@ abstract class HttpSource : CatalogueSource { chapterListParse(response) } } else { - Observable.error(Exception("Licensed - No chapters to show")) + Observable.error(LicensedMangaChaptersException()) } } @@ -404,3 +404,5 @@ abstract class HttpSource : CatalogueSource { */ override fun getFilterList() = FilterList() } + +class LicensedMangaChaptersException : Exception("Licensed - No chapters to show")