Skip to content

Commit 793a67d

Browse files
committed
~ Additional review improvements
1 parent ec111bb commit 793a67d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

docs/exception-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ CoroutineExceptionHandler got java.lang.ArithmeticException
247247
### Exceptions aggregation
248248

249249
When multiple children of a coroutine fail with an exception the
250-
general rule is "the first exception wins", so the first exception gets handed.
250+
general rule is "the first exception wins", so the first exception gets handled.
251251
All additional exceptions that happen after the first one are attached to the first exception as suppressed ones.
252252

253253
<!--- INCLUDE

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public inline fun CoroutineExceptionHandler(crossinline handler: (CoroutineConte
5858
* All _children_ coroutines (coroutines created in the context of another [Job]) delegate handling of their
5959
* exceptions to their parent coroutine, which also delegates to the parent, and so on until the root,
6060
* so the `CoroutineExceptionHandler` installed in their context is never used.
61+
* Coroutines running with [SupervisorJob] do not propagate exceptions to their parent and are treated like root coroutines.
6162
* A coroutine that was created using [async][CoroutineScope.async] always catches all its exceptions and represents them
62-
* in the resulting [Deferred] object, so it cannot result in uncaught exceptions either.
63+
* in the resulting [Deferred] object, so it cannot result in uncaught exceptions.
6364
*
6465
* ### Handling coroutine exceptions
6566
*
@@ -92,10 +93,7 @@ public inline fun CoroutineExceptionHandler(crossinline handler: (CoroutineConte
9293
* * Otherwise, all instances of [CoroutineExceptionHandler] found via [ServiceLoader]
9394
* * and current thread's [Thread.uncaughtExceptionHandler] are invoked.
9495
*
95-
* [CoroutineExceptionHandler] can be invoked from an arbitrary dispatcher used by coroutines in the current job hierarchy.
96-
* For example, if one has a `MainScope` and launches children of the scope in main and default dispatchers, then exception handler can
97-
* be invoked either in main or in default dispatcher thread regardless of
98-
* which particular dispatcher coroutine that has thrown an exception used.
96+
* [CoroutineExceptionHandler] can be invoked from an arbitrary thread.
9997
*/
10098
public interface CoroutineExceptionHandler : CoroutineContext.Element {
10199
/**

0 commit comments

Comments
 (0)