`supervisorScope` kdoc states that `A failure of t...
# coroutines
p
supervisorScope
kdoc states that
A failure of the scope itself (exception thrown in the block or external cancellation)
does not cancel parent job
Is that really the case though ? I’m finding it hard to provide a code example where a failure of the supervisorScope job itself does not cancel the parent.
g
Yes, it's the case, for example if your async failed without supervisor scope parent will be cancelled, with supervisor scope it will cache fail as deferred result without cancelling parent
p
@gildor but that’s about a failure of the child of the supervisor scope. Docs mention about a failure of the scope itself and specifically mentions an exception thrown in block. How can the block throw an exception and not cancel the parent?
g
I think the doc says about supervisorScope itself as parent scope, not about parent of supervisorScope (which may have no scope at all, it called from suspend function)
Or maybe it's indeed a mistake (or a bad explanation of way how supervisorScope semantics) of the doc, because fail or coroutineScope wouldn't cancel parent on error either, it would just throw exception which can be caught
p
^ this Docs are unclear IMO, I could not see any difference from
coroutineScope
WRT cancellation of parent when the scope own job fails — they both fail the parent (unless parent itself is a supervisor?) So I’d love to see an explanation of semantics here or just a code snippet demonstrating what docs mean
g
Probably worth creating an issue about this doc
p