Skip to content

Commit 41319d5

Browse files
committed
Cache missing exception constructors to speed-up non-copyable exception recovery
1 parent 1032f58 commit 41319d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/kotlinx-coroutines-core/src/internal/ExceptionsConstuctor.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ internal fun <E : Throwable> tryCopyException(exception: E): E? {
4040
}
4141
}
4242

43-
cacheLock.write { exceptionConstructors[exception.javaClass] = ctor }
43+
cacheLock.write { exceptionConstructors[exception.javaClass] = (ctor ?: { null }) }
4444
return ctor?.invoke(exception) as E?
4545
}

0 commit comments

Comments
 (0)