Skip to content

Commit e551129

Browse files
committed
Fix the comment
1 parent 1b6b030 commit e551129

File tree

1 file changed

+9
-9
lines changed
  • reactive/kotlinx-coroutines-reactor/src

1 file changed

+9
-9
lines changed

reactive/kotlinx-coroutines-reactor/src/Mono.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import kotlin.coroutines.*
1414
import kotlin.internal.*
1515

1616
/**
17-
* Creates cold [mono][Mono] that will run a given [block] in a coroutine and emits its result.
17+
* Creates cold [mono][Mono] that runs a given [block] in a coroutine and emits its result.
1818
* Every time the returned mono is subscribed, it starts a new coroutine.
19-
* If [block] completes with `null` or its execution was cancelled, [MonoSink.success] is invoked without a value.
20-
* Unsubscribing cancels running coroutine.
19+
* If the result of [block] is `null`, [MonoSink.success] is invoked without a value.
20+
* Unsubscribing cancels the running coroutine.
2121
*
2222
* Coroutine context can be specified with [context] argument.
2323
* If the context does not have any dispatcher nor any other [ContinuationInterceptor], then [Dispatchers.Default] is used.
@@ -84,16 +84,16 @@ private class MonoCoroutine<in T>(
8484
}
8585

8686
override fun onCancelled(cause: Throwable, handled: Boolean) {
87-
try {
88-
/** Cancellation exceptions that were caused by [dispose], that is, came from downstream, are not errors. */
89-
if (getCancellationException() !== cause || !disposed) {
87+
/** Cancellation exceptions that were caused by [dispose], that is, came from downstream, are not errors. */
88+
if (getCancellationException() !== cause || !disposed) {
89+
try {
9090
/** If [sink] turns out to already be in a terminal state, this exception will be passed through the
9191
* [Hooks.onErrorDropped] hook, which is the way to signal undeliverable exceptions in Reactor. */
9292
sink.error(cause)
93+
} catch (e: Throwable) {
94+
// In case of improper error implementation or fatal exceptions
95+
handleCoroutineException(context, cause)
9396
}
94-
} catch (e: Throwable) {
95-
// In case of improper error implementation or fatal exceptions
96-
handleCoroutineException(context, cause)
9797
}
9898
}
9999

0 commit comments

Comments
 (0)