That would instead result in code written like ```...
# coroutines
b
That would instead result in code written like
Copy code
try {
    val element = xmpp.request(Element("request"))
    println("Received element: $element")
} catch (error: FailureException) {
    println("oops... error! ${error.condition}")
} catch (timeout: TimeoutException) {
    println("timeout")
}
d
Right, but his api is callbacks... and Sergey was just showing how to convert that to a suspending function. If there's an error, the coroutine needs to resume with the error so that try/catch will work, otherwise it will stay suspended ...
👍 1
r
Take a look sergey presentation in kotlinconf
He explains to create own suspending function