I develop an android app with Kotlin, api 28. I also use swaggerHub and swagger.json to get all WS. In swaggerHub, I export the client sdk Kotlin.After export the "Kotlin_client_generated" file with swagger, and add it in my project.
Here is an example of ws code, among others ws :
After a while of research, about How to consume this WS, I found that I should use coroutine and I use a GlobalScope with Dispatchers :
I want to handle the exception with try/catch and dispaly the error in a Toast,How can I do that.
I found that I should use Coroutine Scope instead of Global Scope and the Global Scope is highly disouraged.
So,How to use coroutine scope to call web service and handle error ?
Could you please help me to solve my problem