-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw String in Kotlin/JS leads to ClassCastException #4290
Comments
Unfortunately, I see no way of fixing this on our side. To wrap an exception, you first have to catch it somehow, and I didn't succeed in doing that without writing custom |
https://youtrack.jetbrains.com/issue/KT-42465/Provide-a-way-to-catch-everything-in-catch-block-in-common-code states that this is not a supported use case in Kotlin/JS. |
The main topic is: |
@jschneider, I see your point, and I even agree, but this out of scope of If you want to challenge the decision, it's best to share your thoughts under https://youtrack.jetbrains.com/issue/KT-42465/Provide-a-way-to-catch-everything-in-catch-block-in-common-code |
Describe the bug
https://youtrack.jetbrains.com/issue/KT-72174/Kotlin-JS-Coroutines-throwing-JS-string-does-not-stop-the-job
JavaScript allows to throw strings, but it leads to
ClassCastException
is thrown inkotlinx-coroutines-core
Looks
createCauseException
is the root cause ofClassCastException
,String
is notThrowable
so it is trying to be cast toParentJob
kotlinx.coroutines/kotlinx-coroutines-core/common/src/JobSupport.kt
Lines 748 to 752 in 6c6df2b
Provide a Reproducer
The text was updated successfully, but these errors were encountered: