Exception Handling

Learn how coroutines behave in their exception handling.

We'll cover the following

A significant part of how coroutines behave is their exception handling. Just as a program breaks when an uncaught exception slips by, a coroutine breaks in the case of an uncaught exception. This behavior is nothing new—threads also end in such cases. The difference is that coroutine builders also cancel their parents, and each canceled parent cancels all its children. Let’s look at the example below.

Get hands-on with 1200+ tech skills courses.