I'm calling an async call using Retrofit inside an Anko doAsync call. The problem is that I don't know how to catch the IOException that throws the execute() properly, basically the execute call is not getting called. If I comment the if (resultBody is T) line, and put the call inside a trycatch it works like a charm. Anyone knows why?
doAsync {
val response = call.execute()
uiThread {
if (response.isSuccessful) {
val resultBody = response.body()
if (resultBody is T)
callback.onSuccess(resultBody)
}
}
}