Is it possible to find out which coroutine(s) were...
# coroutines
j
Is it possible to find out which coroutine(s) were the reason for
withTimeout
throwing a
TimeoutCancellationException
?
s
What do you mean by “which coroutine”? What information would you expect to get back that would let you identify a specific coroutine?
You could for example do this:
Copy code
val job = launch {
    doStuff()
}
select {
    job.onJoin { }
    onTimeout(1000) {
        job.children.forEach { job ->
            if (job.isActive) {
                println(job) // but is this helpful?
            }
        }
        job.cancel()
    }
}
but I don’t think it would be useful.