Resuming Suspension with an Exception
Learn how to resume a coroutine with an exception and suspend a coroutine with examples.
We'll cover the following
Every function we call might return some value or throw an exception. The same is true for suspendCoroutine
. When resume
is called, it returns data passed as an argument. When resumeWithException
is called, the exception we pass as an argument is conceptually thrown from the suspension point. Let’s run an example that shows throwing an exception on resuming.
Get hands-on with 1400+ tech skills courses.