mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-21 19:51:51 +01:00
Fix exception formatter's format (#9413)
This commit is contained in:
parent
ea6e5eebac
commit
058ee4c86b
@ -5,15 +5,17 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.network.HttpException
|
import eu.kanade.tachiyomi.network.HttpException
|
||||||
import tachiyomi.data.source.NoResultsException
|
import tachiyomi.data.source.NoResultsException
|
||||||
import tachiyomi.domain.source.model.SourceNotInstalledException
|
import tachiyomi.domain.source.model.SourceNotInstalledException
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
context(Context)
|
context(Context)
|
||||||
val Throwable.formattedMessage: String
|
val Throwable.formattedMessage: String
|
||||||
get() = when {
|
get() {
|
||||||
this is NoResultsException -> getString(R.string.no_results_found)
|
when (this) {
|
||||||
this is SourceNotInstalledException -> getString(R.string.loader_not_implemented_error)
|
is NoResultsException -> return getString(R.string.no_results_found)
|
||||||
this is HttpException -> "$message: ${getString(R.string.http_error_hint)}"
|
is SourceNotInstalledException -> return getString(R.string.loader_not_implemented_error)
|
||||||
this is IOException || this is Exception -> message ?: this::class.simpleName.orEmpty()
|
is HttpException -> return "$message: ${getString(R.string.http_error_hint)}"
|
||||||
this::class.simpleName != null -> "${this::class.simpleName}: $message"
|
}
|
||||||
else -> message.orEmpty()
|
return when (val className = this::class.simpleName) {
|
||||||
|
"Exception", "IOException" -> message ?: className
|
||||||
|
else -> "$className: $message"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user