Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Jan 21, 2025
2 parents 93ca6d6 + c12bd87 commit 7de0ea8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
import kotlin.math.absoluteValue

/** Api has not yet been published to stable, and will cause MethodNotFoundException on stable */
/** Api has not yet been published to stable, and will cause `NoSuchMethodException` on stable */
@MustBeDocumented // Same as java.lang.annotation.Documented
@Retention(AnnotationRetention.SOURCE) // This is only an IDE hint, and will not be used in the runtime
annotation class Prerelease
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import java.net.UnknownHostException
import javax.net.ssl.SSLHandshakeException
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.reflect.full.NoSuchPropertyException

const val DEBUG_EXCEPTION = "THIS IS A DEBUG EXCEPTION!"
const val DEBUG_PRINT = "DEBUG PRINT"
Expand Down Expand Up @@ -122,6 +123,14 @@ fun<T> throwAbleToResource(
throwable: Throwable
): Resource<T> {
return when (throwable) {
is NoSuchMethodException, is NoSuchFieldException, is NoSuchMethodError, is NoSuchFieldError, is NoSuchPropertyException -> {
Resource.Failure(
false,
null,
null,
"App or extension is outdated, update the app or try pre-release.\n${throwable.message}" // todo add exact version?
)
}
is NullPointerException -> {
for (line in throwable.stackTrace) {
if (line?.fileName?.endsWith("provider.kt", ignoreCase = true) == true) {
Expand Down

0 comments on commit 7de0ea8

Please sign in to comment.