mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-17 19:25:55 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -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
|
||||
|
@ -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"
|
||||
@ -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) {
|
||||
|
Reference in New Issue
Block a user