this is full stack trace.
# coroutines
t
this is full stack trace.
g
This is because of coroutineScope
t
I believe launch{} requires something kind of CoroutineScope, but other type of scope builder raises same result. how to fix it?
g
Exactly, you just all the time tries to hide you async code
you shouldn’t do this
and use parent coroutine scope instead
I don’t know what exactly you want to achive, as I said, so hard to give you advice
t
I would like to see the smallest example that uses CoroutineExceptionHandler. Is that deprecated?
g
No, it is not
just do not use coroutineScope function which has different semantics
use GlobalScope or some parent scope for those examples
t
Ok, this worked. thanks.
Copy code
GlobalScope.launch( handler)  {
        error("inside launch")
    }
    delay(1000)
CoroutineExceptionHandler can't cooperative with structured concurrency?
g
Also instead you can make your test coroutines exception handler function extension to coroutine scope, this is how this should work in real life rather than use GlobalScope
But it's of course fine just if you want to play with some function
CoroutineExceptionHandler can't cooperative with structured concurrency?
It can, but you should use supervision scope otherwise parent will be cancelled in case of error
t
now I checked SupervisorCoroutine's code and I see it have override fun childCancelled(cause: Throwable): Boolean = false . this is reason why it is not help that just using outer context + SupervisorJob . thanks.