getOrThrow

Returns the encapsulated T if the operation succeeded, or throws the encapsulated exception if it failed.

Example:

val result = channel.tryReceive()
if (result.isSuccess) {
println("Successfully received the value ${result.getOrThrow()}")
}

Throws

if the operation failed, but the channel was not closed with a cause.