Hi All, I am working on a generic ktor client abst...
# ktor
d
Hi All, I am working on a generic ktor client abstraction on my iOS and Android app where I want any client to call our networking library and make request and can send the Model they expect and Error Model they expect from the API.
Copy code
APIClient.GETRequest<UserData, Error>("/kmm-test", { success -> 
    Log.i(TAG, "Success: ${it.toString()}")
}, { error -> 
    Log.e(TAG, "Error: ${it.cause}")
}, { genericError ->
    Log.e(TAG, "Throwable: ${it.message}")
})
it looks something like this. I am handeling the generic error with ktor client engine. but the error from API is still a mystery to me, can someone guide me to a good direction ?
a
There are different types of exception may be thrown. There is a feature request to address this problem by unifying exception types under one type.
👍 1
d
Thanks @Aleksei Tirman [JB], I see the issue is open, will keep a tag on this issue, thanks again for sharing the link 🙏