Skip to content

Commit 884c51b

Browse files
committed
Fixes
1 parent 1b5d633 commit 884c51b

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

reactive/kotlinx-coroutines-reactive/src/Publish.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public class PublisherCoroutine<in T>(
8080
override fun invokeOnClose(handler: (Throwable?) -> Unit): Nothing =
8181
throw UnsupportedOperationException("PublisherCoroutine doesn't support invokeOnClose")
8282

83-
// TODO: will throw if `null` is passed -- is throwing this kind of programmer-induced errors okay?
8483
override fun trySend(element: T): ChannelResult<Unit> =
8584
if (!mutex.tryLock()) {
8685
ChannelResult.failure()
@@ -134,7 +133,7 @@ public class PublisherCoroutine<in T>(
134133
*/
135134
private fun doLockedNext(elem: T): Throwable? {
136135
if (elem == null) {
137-
throw NullPointerException("Can not emit null")
136+
throw NullPointerException("Attempted to emit `null` inside a reactive publisher")
138137
}
139138
/** This guards against the case when the caller of this function managed to lock the mutex not because some
140139
* elements were requested--and thus it is permitted to call `onNext`--but because the channel was closed.

reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal fun handleUndeliverableException(cause: Throwable, context: CoroutineCo
2020
try {
2121
RxJavaPlugins.onError(cause)
2222
} catch (e: Throwable) {
23+
cause.addSuppressed(e)
2324
handleCoroutineException(context, cause)
2425
}
2526
}

reactive/kotlinx-coroutines-rx3/src/RxCancellable.kt

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal fun handleUndeliverableException(cause: Throwable, context: CoroutineCo
2020
try {
2121
RxJavaPlugins.onError(cause)
2222
} catch (e: Throwable) {
23+
cause.addSuppressed(e)
2324
handleCoroutineException(context, cause)
2425
}
2526
}

0 commit comments

Comments
 (0)