https://kotlinlang.org logo
#coroutines
Title
# coroutines
b

bdawg.io

01/04/2018, 11:58 PM
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

dave08

01/05/2018, 3:37 AM
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

radityagumay

01/06/2018, 12:54 PM
Take a look sergey presentation in kotlinconf
He explains to create own suspending function
3 Views