This commit is contained in:
Koitharu
2024-11-24 09:37:46 +02:00
parent f11a9d8235
commit e65a3b43f6
5 changed files with 17 additions and 7 deletions

View File

@@ -78,6 +78,9 @@ open class BaseApp : Application(), Configuration.Provider {
override fun onCreate() {
super.onCreate()
if (ACRA.isACRASenderServiceProcess()) {
return
}
AppCompatDelegate.setDefaultNightMode(settings.theme)
AppCompatDelegate.setApplicationLocales(settings.appLocales)
// TLS 1.3 support for Android < 10

View File

@@ -1,3 +1,3 @@
package org.koitharu.kotatsu.core.exceptions
class CaughtException(cause: Throwable, override val message: String?) : RuntimeException(cause)
class CaughtException(cause: Throwable) : RuntimeException("${cause.javaClass.simpleName}(${cause.message})", cause)

View File

@@ -79,7 +79,9 @@ class ParserMangaRepository(
}
override suspend fun getPageUrl(page: MangaPage): String = mirrorSwitchInterceptor.withMirrorSwitching {
parser.getPageUrl(page)
parser.getPageUrl(page).also { result ->
check(result.isNotEmpty()) { "Page url is empty" }
}
}
override suspend fun getFilterOptions(): MangaListFilterOptions = filterOptionsLazy.get()

View File

@@ -58,7 +58,7 @@ class ErrorDetailsDialog : AlertDialogFragment<DialogErrorDetailsBinding>() {
if (exception.isReportable()) {
builder.setPositiveButton(R.string.report) { _, _ ->
dismiss()
exception.report()
exception.report(silent = true)
}
}
return builder

View File

@@ -9,6 +9,7 @@ import okhttp3.Response
import okio.FileNotFoundException
import okio.IOException
import okio.ProtocolException
import org.acra.ktx.sendSilentlyWithAcra
import org.acra.ktx.sendWithAcra
import org.jsoup.HttpStatusException
import org.koitharu.kotatsu.R
@@ -37,9 +38,9 @@ import org.koitharu.kotatsu.parsers.exception.NotFoundException
import org.koitharu.kotatsu.parsers.exception.ParseException
import org.koitharu.kotatsu.parsers.exception.TooManyRequestExceptions
import org.koitharu.kotatsu.scrobbling.common.domain.ScrobblerAuthRequiredException
import java.io.ObjectOutputStream
import java.net.ConnectException
import java.net.NoRouteToHostException
import java.io.ObjectOutputStream
import java.net.SocketTimeoutException
import java.net.UnknownHostException
import java.util.Locale
@@ -193,9 +194,13 @@ fun Throwable.isNetworkError(): Boolean {
return this is UnknownHostException || this is SocketTimeoutException
}
fun Throwable.report() {
val exception = CaughtException(this, "${javaClass.simpleName}($message)")
exception.sendWithAcra()
fun Throwable.report(silent: Boolean = false) {
val exception = CaughtException(this)
if (silent) {
exception.sendSilentlyWithAcra()
} else {
exception.sendWithAcra()
}
}
fun Throwable.isWebViewUnavailable(): Boolean {