@@ -27,7 +27,7 @@ private val stackTraceRecoveryClassName = runCatching {
27
27
}.getOrElse { stackTraceRecoveryClass }
28
28
29
29
internal actual fun <E : Throwable > recoverStackTrace (exception : E ): E {
30
- if (recoveryDisabled(exception) ) return exception
30
+ if (! RECOVER_STACK_TRACES ) return exception
31
31
// No unwrapping on continuation-less path: exception is not reported multiple times via slow paths
32
32
val copy = tryCopyException(exception) ? : return exception
33
33
return copy.sanitizeStackTrace()
@@ -53,7 +53,7 @@ private fun <E : Throwable> E.sanitizeStackTrace(): E {
53
53
}
54
54
55
55
internal actual fun <E : Throwable > recoverStackTrace (exception : E , continuation : Continuation <* >): E {
56
- if (recoveryDisabled(exception) || continuation !is CoroutineStackFrame ) return exception
56
+ if (! RECOVER_STACK_TRACES || continuation !is CoroutineStackFrame ) return exception
57
57
return recoverFromStackFrame(exception, continuation)
58
58
}
59
59
@@ -147,15 +147,15 @@ private fun mergeRecoveredTraces(recoveredStacktrace: Array<StackTraceElement>,
147
147
148
148
@Suppress(" NOTHING_TO_INLINE" )
149
149
internal actual suspend inline fun recoverAndThrow (exception : Throwable ): Nothing {
150
- if (recoveryDisabled(exception) ) throw exception
150
+ if (! RECOVER_STACK_TRACES ) throw exception
151
151
suspendCoroutineUninterceptedOrReturn<Nothing > {
152
152
if (it !is CoroutineStackFrame ) throw exception
153
153
throw recoverFromStackFrame(exception, it)
154
154
}
155
155
}
156
156
157
157
internal actual fun <E : Throwable > unwrap (exception : E ): E {
158
- if (recoveryDisabled(exception) ) return exception
158
+ if (! RECOVER_STACK_TRACES ) return exception
159
159
val cause = exception.cause
160
160
// Fast-path to avoid array cloning
161
161
if (cause == null || cause.javaClass != exception.javaClass) {
@@ -170,9 +170,6 @@ internal actual fun <E : Throwable> unwrap(exception: E): E {
170
170
}
171
171
}
172
172
173
- private fun <E : Throwable > recoveryDisabled (exception : E ) =
174
- ! RECOVER_STACK_TRACES || exception is NonRecoverableThrowable
175
-
176
173
private fun createStackTrace (continuation : CoroutineStackFrame ): ArrayDeque <StackTraceElement > {
177
174
val stack = ArrayDeque <StackTraceElement >()
178
175
continuation.getStackTraceElement()?.let { stack.add(it) }
0 commit comments