So ultimately, I'd like this code to do what their...
# coroutines
n
So ultimately, I'd like this code to do what their method calls are named when I call them:
Copy code
fun thisShouldPrintHi() = async<Unit> {
    try {
        val reason = await(async<String> {
            throw IOException()
        })
        TODO(reason)
    } catch(e: IOException) {
        println("Hi")
    }
}

fun thisShouldCrashWithANotImplementedError() = async<Unit> {
    try {
        val reason = await(async<String> {
            "Hello"
        })
        TODO(reason)
    } catch(e: IOException) {
        println("Hi")
    }
}
And ideally without appending an extra method call like
exceptionally { }
to it, because I tend to forget those. I guess such a call would be placed inside the
async
method, but when applied like above, every error thrown makes the app crash, even the
IOException
in the
thisShouldPrintHi()
function.