In the docs, it says;
Coroutine builders come in two flavors: propagating exceptions automatically (launch and actor) or exposing them to users (async and produce). The former treat exceptions as unhandled, similar to Java’s
Thread.uncaughtExceptionHandler
, while the latter are relying on the user to consume the final exception, for example via await or receive (produce and receive are covered later in Channels section).
I don’t quite get the difference between launch and async in terms of exception handling. In either case, if the exception is not handled, program crashes. It only works the way it’s documented if you run these coroutines in the GlobalScope as, probably, they run on their own in a fire and forget fashion and without a parent.
If that’s the case, I think the docs might be a bit misleading (of course if I’m not mistaken).