Show exception class in snackbar message (#9006)
* Show exception class in snackbar message * omit IOException too (cherry picked from commit 589bdba0b1538266b7786591046f88a1159cbb8c) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt
This commit is contained in:
parent
8ff51227bd
commit
fb937d9ad6
@ -402,8 +402,7 @@ class MangaInfoScreenModel(
|
|||||||
|
|
||||||
logcat(LogPriority.ERROR, e)
|
logcat(LogPriority.ERROR, e)
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
val errorMessage = e.message.orEmpty().ifEmpty { e.toString() }
|
snackbarHostState.showSnackbar(message = e.snackbarMessage)
|
||||||
snackbarHostState.showSnackbar(message = errorMessage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -995,7 +994,7 @@ class MangaInfoScreenModel(
|
|||||||
context.getString(R.string.no_chapters_error)
|
context.getString(R.string.no_chapters_error)
|
||||||
} else {
|
} else {
|
||||||
logcat(LogPriority.ERROR, e)
|
logcat(LogPriority.ERROR, e)
|
||||||
e.message.orEmpty().ifEmpty { e.toString() }
|
e.snackbarMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
@ -1647,6 +1646,13 @@ val chapterDecimalFormat = DecimalFormat(
|
|||||||
.apply { decimalSeparator = '.' },
|
.apply { decimalSeparator = '.' },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val Throwable.snackbarMessage: String
|
||||||
|
get() = when (val className = this::class.simpleName) {
|
||||||
|
null -> message ?: ""
|
||||||
|
"Exception", "HttpException", "IOException" -> message ?: className
|
||||||
|
else -> "$className: $message"
|
||||||
|
}
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
sealed class PagePreviewState {
|
sealed class PagePreviewState {
|
||||||
object Unused : PagePreviewState()
|
object Unused : PagePreviewState()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user