Skip to content

Commit 167c451

Browse files
committed
Removed private handleExceptionViaJob (not needed and bad name)
1 parent 2d8cad0 commit 167c451

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

common/kotlinx-coroutines-core-common/src/CoroutineExceptionHandler.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ internal expect fun handleCoroutineExceptionImpl(context: CoroutineContext, exce
2424
*/
2525
@JvmOverloads // binary compatibility
2626
public fun handleCoroutineException(context: CoroutineContext, exception: Throwable, caller: Job? = null) {
27-
if (!handleExceptionViaJob(context, exception, caller)) {
28-
handleExceptionViaHandler(context, exception)
29-
}
30-
}
31-
32-
private fun handleExceptionViaJob(context: CoroutineContext, exception: Throwable, caller: Job?): Boolean {
3327
// Ignore CancellationException (they are normal ways to terminate a coroutine)
34-
if (exception is CancellationException) return true
35-
// If job is successfully cancelled, we're done
28+
if (exception is CancellationException) return // nothing to do
29+
// Try propagate exception to parent
3630
val job = context[Job]
37-
return job !== null && job !== caller && job.cancel(exception)
31+
if (job !== null && job !== caller && job.cancel(exception)) return // handle by parent
32+
// otherwise -- use exception handlers
33+
handleExceptionViaHandler(context, exception)
3834
}
3935

4036
internal fun handleExceptionViaHandler(context: CoroutineContext, exception: Throwable) {

0 commit comments

Comments
 (0)