Ability to report non-fatal exceptions

This commit is contained in:
Koitharu
2022-07-02 11:02:03 +03:00
parent a48abc56dd
commit ce97c8f7d9
12 changed files with 118 additions and 44 deletions

View File

@@ -1,12 +1,14 @@
package org.koitharu.kotatsu.utils.ext
import android.content.res.Resources
import org.acra.ACRA
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
import org.koitharu.kotatsu.core.exceptions.EmptyHistoryException
import org.koitharu.kotatsu.core.exceptions.UnsupportedFileException
import org.koitharu.kotatsu.core.exceptions.WrongPasswordException
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
import org.koitharu.kotatsu.parsers.model.Manga
import java.io.FileNotFoundException
import java.net.SocketTimeoutException
@@ -20,4 +22,6 @@ fun Throwable.getDisplayMessage(resources: Resources) = when (this) {
is SocketTimeoutException -> resources.getString(R.string.network_error)
is WrongPasswordException -> resources.getString(R.string.wrong_password)
else -> localizedMessage ?: resources.getString(R.string.error_occurred)
}
}
fun ACRA.setCurrentManga(manga: Manga?) = errorReporter.putCustomData("manga", manga?.publicUrl.toString())