ade
02/25/2022, 9:27 AMsealed class Resolved<out T> {
data class Success<out T>(val data: T) : Resolved<T>()
data class Error(val exception: Exception) : Resolved<Nothing>()
But in case of Error, how can I extract the exception on the iOS side? If Resolved.Error has a type parameter (Error<T>) i can do in swift:
if
*let* val = response *as*? ResolvedError { ...
But when it doesnt and is typed as Resolved<Nothing> I cannot. Or at least I don't know how. Any tips?fun <T> Resolved<T>.errorOrNull() = (this as? Resolved.Error)?.exception
and in swift
if
*let* val = response?.errorOrNull() {
print("Found an exception \(val)")
}