Challenge: Exception Handling

Solve a challenge regarding exception handling.

We'll cover the following

Problem

Write a code where the exception will be thrown by await(). End one coroutine with an exception, and that exception will be thrown by await(). End another coroutine that will print “Educative Inc.” Use the try and catch block for handling exceptions.

Restriction

The output will be available in the terminal.

Output

The output will be as follows; here, we will see a delay of two seconds before and after the exception is thrown.

kotlinx.coroutines.app.MyException
Educative Inc.

Get hands-on with 1200+ tech skills courses.