Skip to content
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

Select builder reports exception to the global handler instead of re-throwing it when select clause is suspended #1130

Closed
qwwdfsad opened this issue Apr 21, 2019 · 0 comments
Assignees
Labels

Comments

@qwwdfsad
Copy link
Collaborator

coroutineScope {
    val channel = Channel<Unit>()
    val job = launch {
        channel.send(Unit)
        println("Thrown")
        throw TestException()
    }

    var isDone = false
    while (!isDone) {
        println("Selecting")
        select<Unit> {
            channel.onReceiveOrNull {
                println("Receive $it")
                isDone = it == null
            }

            job.onJoin {
                println("Joined")
            }
        }
    }
}

will report the exception to the global exception handler and then will hang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants