Another quick `ktor-client` question. Is the ```sc...
# ktor
f
Another quick
ktor-client
question. Is the
Copy code
scope.receivePipeline.intercept(HttpReceivePipeline.State) {
always getting executed even if the API call failed (e.g. Invalid Host or Timeout)? If yes what value would
context.response.status.value
contain? And if not what pipeline do I need to adjust to to catch that?
j
There is no response and it should crash
f
Sorry so the intercept callback WILL be called but the
context.response.status.value
will fail?
or that would not be called at all? In that case is there any pipeline I can listen to to catch that type of error (I need to ALWAYS do some processing after a call is finished (regardless if it was successful or not))
a
If there is a network failure then the
receivePipeline
won't be executed. To catch failures and normal responses you can intercept the
HttpRequestPipeline
using any phase before
Send
:
Copy code
client.requestPipeline.intercept(HttpRequestPipeline.Before) {}
f
but how do I catch an error with this?