Skip to content

Commit c12bd87

Browse files
authored
Added NoSuchMethodException error message
1 parent 40abf49 commit c12bd87

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import kotlin.io.encoding.Base64
2323
import kotlin.io.encoding.ExperimentalEncodingApi
2424
import kotlin.math.absoluteValue
2525

26-
/** Api has not yet been published to stable, and will cause MethodNotFoundException on stable */
26+
/** Api has not yet been published to stable, and will cause `NoSuchMethodException` on stable */
2727
@MustBeDocumented // Same as java.lang.annotation.Documented
2828
@Retention(AnnotationRetention.SOURCE) // This is only an IDE hint, and will not be used in the runtime
2929
annotation class Prerelease

library/src/commonMain/kotlin/com/lagradost/cloudstream3/mvvm/ArchComponentExt.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import java.net.UnknownHostException
1010
import javax.net.ssl.SSLHandshakeException
1111
import kotlin.coroutines.CoroutineContext
1212
import kotlin.coroutines.EmptyCoroutineContext
13+
import kotlin.reflect.full.NoSuchPropertyException
1314

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

0 commit comments

Comments
 (0)