Skip to content

Commit

Permalink
Additional catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Oct 21, 2020
1 parent 8df90dd commit 2bc1165
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@
@file:JvmName("CommonKt")
package dev.gitlive.firebase

import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.channels.ClosedSendChannelException
import kotlinx.coroutines.channels.SendChannel
import kotlin.jvm.JvmMultifileClass
Expand Down Expand Up @@ -67,4 +68,6 @@ inline fun <E> SendChannel<E>.offerOrNull(element: E): Boolean? = try {
offer(element)
} catch (e : ClosedSendChannelException) {
null
} catch (e : CancellationException) {
null
}

0 comments on commit 2bc1165

Please sign in to comment.