```suspend fun requestSomething() { return suspend...
# coroutines
j
Copy code
suspend fun requestSomething() {
return suspendableCoroutine{cont-> 
api.makeACall(object: Response{
     fun onResponse(response: Response){
       cont.resume(response)
}
fun onError(error: Error) {
     cont.resumeWithException(Throwable(error.message)
}
})
}
}
And where I trigger the coroutine:
Copy code
fun aMethod(){
      launch(Android){
     try{
      requestSomething()
}catch(e: Exception) {
  Timber.d("something went wrong")
}
}
}
g
Why do you use such low level API for coroutines. Don't what is you library for requests, but looks that you can easily write much more high level one with support of cancellation for example