I have expect success set to true when initializin...
# multiplatform
h
I have expect success set to true when initializing this client, but still getting this error. What can be causing this? I suspect it has to do with the timeout duration so I increased that. Also what are the best practices with handling errors using ktor-client in multiplatform?
j
That's the stacktrace, what's the exception and message?
h
This is what I'm getting on the play store console. Same issue I believe
j
Ah
ClientRequestException
, that's thrown when you have
expectSuccess = true
and you receive a 4XX status code
👍 1
So you should either do
expectSuccess = false
and check whether the response was success, or keep
expectSuccess = true
and catch any potential exceptions
👍 1
Incidentally, there's also
RedirectResponseException
for 3XX and
ServerResponseException
for 5XX, it might pay to handle those too
👍 2
h
I see, I was getting some 499 so I think it may have to do with the timeout
j
499 isn't a standard code, you'd have to check your server docs or something to figure the cause out
j
notable non-standard
I think nginx uses it sometimes?
👍 1