mboudraa
06/11/2021, 6:20 PMResult.getOrThrow
throw a ClassCastException even if the result is successful.
Is there any workaround while the fix is being released. My app depends on it to work properlyephemient
06/11/2021, 7:30 PMmboudraa
06/11/2021, 8:01 PMmboudraa
06/11/2021, 8:02 PM//Necessary because of <https://youtrack.jetbrains.com/issue/KT-44867>
private fun <T> Result<T>.unwrap(): T {
return fold(
onSuccess = {
when (it) {
is Result<*> -> it.getOrThrow() as T
else -> it
}
},
onFailure = { t -> throw t }
)
}
ilya.gorbunov
06/12/2021, 1:08 AMmboudraa
06/12/2021, 10:40 PMchristophsturm
06/14/2021, 9:14 AMilya.gorbunov
06/15/2021, 12:28 AMilya.gorbunov
06/15/2021, 12:36 AMClassCastException
either in Kotlin 1.5.0 or 1.5.10 anymore.
There are some other known problems with kotlin.Result
leading to ClassCastException
, though. Could you provide the code that reproduces this problem in your case?