Skip to content

Commit

Permalink
Recover stacktrace of CancellationException from suspendCancellable
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Apr 24, 2019
1 parent 2740aa5 commit 9e9c9a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ internal open class CancellableContinuationImpl<in T>(
if (job != null && !job.isActive) {
val cause = job.getCancellationException()
cancelResult(state, cause)
throw cause
throw recoverStackTrace(cause, this)
}
}
return getSuccessfulResult(state)
Expand Down
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/common/src/Dispatched.kt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ internal abstract class DispatchedTask<in T>(
if (job != null && !job.isActive) {
val cause = job.getCancellationException()
cancelResult(state, cause)
continuation.resumeWithException(cause)
continuation.resumeWithStackTrace(cause)
} else {
val exception = getExceptionalResult(state)
if (exception != null)
Expand Down

0 comments on commit 9e9c9a3

Please sign in to comment.