diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt index 37619f7f2..1249831d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt @@ -352,10 +352,7 @@ open class BrowseCatalogueController(bundle: Bundle) : snack?.dismiss() if (catalogue_view != null) { - val message = if (error is NoResultsException) catalogue_view.context.getString(R.string.no_results_found) else (error.message - ?: "") - - snack = catalogue_view.snack(message, Snackbar.LENGTH_INDEFINITE) { + snack = catalogue_view.snack(getErrorMessage(error), Snackbar.LENGTH_INDEFINITE) { setAction(R.string.action_retry) { // If not the first page, show bottom progress bar. if (adapter.mainItemCount > 0) { @@ -370,6 +367,18 @@ open class BrowseCatalogueController(bundle: Bundle) : } } + private fun getErrorMessage(error: Throwable): String { + if (error is NoResultsException) { + return catalogue_view.context.getString(R.string.no_results_found) + } + + return when { + error.message == null -> "" + error.message!!.startsWith("HTTP error") -> "${error.message}: ${catalogue_view.context.getString(R.string.http_error_hint)}" + else -> error.message!! + } + } + /** * Sets a new progress item and reenables the scroll listener. */ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23d824810..f332274f1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -378,6 +378,7 @@ Please enable at least one valid source No more results No results found + Check website in WebView Local manga Other Default can\'t be selected with other categories