@@ -137,17 +137,18 @@ public interface Job : CoroutineContext.Element {
137
137
public val isCancelled: Boolean
138
138
139
139
/* *
140
- * Returns [CancellationException] that signals the completion of this job.
140
+ * Returns [CancellationException] that signals the completion of this job. This function is
141
+ * used by [cancellable][suspendCancellableCoroutine] suspending functions. They throw exception
142
+ * returned by this function when they suspend in the context of this job and this job becomes _complete_.
141
143
*
142
- * It returns the original [cancel] cause if it is an instance of [CancellationException] or
143
- * an instance of [JobCancellationException] if this job was cancelled with a cause of
144
- * different type, was cancelled without a cause or had completed normally.
144
+ * This function returns the original [cancel] cause of this job if that `cause` was an instance of
145
+ * [CancellationException]. Otherwise (if this job was cancelled with a cause of a different type, or
146
+ * was cancelled without a cause, or had completed normally), an instance of [JobCancellationException] is
147
+ * returned. The [JobCancellationException.cause] of the resulting [JobCancellationException] references
148
+ * the original cancellation cause that was passed to [cancel] function.
145
149
*
146
- * This function throws [IllegalStateException] when invoked for an job that has not
150
+ * This function throws [IllegalStateException] when invoked on a job that has not
147
151
* [completed][isCompleted] nor [cancelled][isCancelled] yet.
148
- *
149
- * The [cancellable][suspendCancellableCoroutine] suspending functions throw this exception
150
- * when trying to suspend in the context of this job.
151
152
*/
152
153
public fun getCancellationException (): CancellationException
153
154
0 commit comments