Skip to content

Commit fb5717a

Browse files
committed
Avoid extra exception creation on normal channel close
1 parent 59e190d commit fb5717a

File tree

1 file changed

+1
-1
lines changed
  • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/channels

1 file changed

+1
-1
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/channels/Produce.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private class ProducerCoroutine<E>(
106106
override val channel: Channel<E>
107107
) : AbstractCoroutine<Unit>(context, active = true), ProducerScope<E>, ProducerJob<E>, Channel<E> by channel {
108108
override fun afterCompletion(state: Any?) {
109-
val cause = (state as? CompletedExceptionally)?.exception
109+
val cause = (state as? CompletedExceptionally)?.cause
110110
if (!channel.close(cause) && cause != null)
111111
handleCoroutineException(context, cause)
112112
}

0 commit comments

Comments
 (0)