In my source code,
I use this code:
val client = HttpClient(CIO)
val response: HttpResponse = client.get("http://127.0.0.1:8000")
in which it is defined in this package io.ktor.client
.
In this instance, if io.ktor.client.HttpClient.get()
method throws an exception, my app will crash.
I am developing android app, so maybe if an error occurs, maybe I would write it to a local file or something that does not throw exception.
What I tried:
I tried to find the source code for io.ktor.client.HttpClient.get()
method in the .gradle folder.
Inside caches/modules-2/files-2.1/io.ktor folder, I tried to find the source code either in .kt or .java file, but could not find it.
I thought if I could manually re-writes the dependency I am using to not throw Exception so that I could manually handle the error in my application. But it was not found.
Expectation:
Is there a way to override the error handling implementaion ? perhaps a method to override ?
You should try:
if(error_code!=200):
print("unsuccessful http
request")
Sorry, I give you the code in other pseudo language. But I hope you get the point.