Skip to content

Commit 9e9c9a3

Browse files
committed
Recover stacktrace of CancellationException from suspendCancellable
1 parent 2740aa5 commit 9e9c9a3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ internal open class CancellableContinuationImpl<in T>(
179179
if (job != null && !job.isActive) {
180180
val cause = job.getCancellationException()
181181
cancelResult(state, cause)
182-
throw cause
182+
throw recoverStackTrace(cause, this)
183183
}
184184
}
185185
return getSuccessfulResult(state)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ internal abstract class DispatchedTask<in T>(
229229
if (job != null && !job.isActive) {
230230
val cause = job.getCancellationException()
231231
cancelResult(state, cause)
232-
continuation.resumeWithException(cause)
232+
continuation.resumeWithStackTrace(cause)
233233
} else {
234234
val exception = getExceptionalResult(state)
235235
if (exception != null)

0 commit comments

Comments
 (0)