hello, I have a question about client error handli...
# ktor
w
hello, I have a question about client error handling. if i call
request<HttpResponse>
I can check for status and other things in order to do my own error handling, but then i can't leverage the built in Json deserialization of my object. but if i call
request<MyObject>
in order to get the deserialization, it is not clear how to check and handle errors. I am looking for something like Fuel's `Result.fold`:
Copy code
inline fun <X> fold(success: (V) -> X, failure: (E) -> X): X = when (this) {
        is Success -> success(this.value)
        is Failure -> failure(this.error)
    }
. is there something like this in ktor?
o
If you use
HttpResponse
you can use
receive()
to automatically deserialize json.
w
Oh I didnt see that. Ill try that, thanks!
That worked for me. Thanks!