We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When callbackflow is chained with timeout directly, and closed with an exception, the exception won't be sent to downstream.
callbackflow
timeout
Coroutines version 1.8.0. Kotlin version 1.9.21.
Provide a Reproducer
val flow = callbackFlow<Int> { close(IllegalStateException("Test Exception")) }.timeout(5.seconds) try { flow.collect() } catch (e: Exception) { println("exception got: $e") }
I expect this to print: exception got: java.lang.IllegalStateException: Test Exception
exception got: java.lang.IllegalStateException: Test Exception
But no exception is caught.
However, if I add any operator between callbackflow and timeout, it works as expected,
val flow = callbackFlow<Int> { close(IllegalStateException("Test Exception")) }.catch{throw it}.timeout(5.seconds) try { flow.collect() } catch (e: Exception) { println("exception got: $e") }
The text was updated successfully, but these errors were encountered:
Fix Flow.timeout swallowing the channel closure exception
Flow.timeout
8dcb1f1
Fixes #4071
Fix Flow.timeout swallowing the channel closure exception (#4072)
0ca7358
Will be fixed in 1.8.1.
Sorry, something went wrong.
Fix Flow.timeout swallowing the channel closure exception (Kotlin#4072
40e0a38
) Fixes Kotlin#4071
Successfully merging a pull request may close this issue.
Describe the bug
When
callbackflow
is chained withtimeout
directly, and closed with an exception, the exception won't be sent to downstream.Coroutines version 1.8.0. Kotlin version 1.9.21.
Provide a Reproducer
I expect this to print:
exception got: java.lang.IllegalStateException: Test Exception
But no exception is caught.
However, if I add any operator between callbackflow and timeout, it works as expected,
The text was updated successfully, but these errors were encountered: