Open
Description
Describe the bug
JavaScript allows to throw strings, but it leads to ClassCastException
is thrown in kotlinx-coroutines-core
Looks createCauseException
is the root cause of ClassCastException
, String
is not Throwable
so it is trying to be cast to ParentJob
kotlinx.coroutines/kotlinx-coroutines-core/common/src/JobSupport.kt
Lines 748 to 752 in 6c6df2b
Provide a Reproducer
class TestClient2 {
@Test
fun testThrowString() = runTest {
val job = launch {
println("throwing a JS string")
throw IllegalStateException("EMPTY") //In JS everything can be thrown, even a String!
println("not executed....")
}
println("waiting for job")
job.join()
}
}