takeError

fun <T> ReceiveChannel<T>.takeError(name: String? = null): Throwable

Assert that the next event received is Event.Error, and return the error. This function will not suspend. On JVM and Android, it will attempt to throw if invoked in a suspending context.

Throws

if the next event was completion or an error.