version 1.3.0, client: apache
If a POST request is cancelled due to a timeout or server not reachable, a JobCancellationException is thrown. But it contains no information about the problem/cause.
Steps to reproduce the behavior:
runBlocking block.Job was cancelled, and stack trace having length 0.Expected behavior
Meaningful exception which describes the actual network problem, and contains a non-empty stack trace.
In 1.3.1 instead of actual exception CancellationException is thrown, but anyway it breaks existing code. The following test fails in 1.3.0/1.3.1:
@Test
fun `test ktor connect exception`() {
assertFailsWith(ConnectException::class) {
HttpClient(Apache).use { httpClient ->
runBlocking {
httpClient.get<HttpResponse>("http://localhost:1234")
}
}
}
}
Would adding CancellationException to our list of retryable exceptions be a reasonable workaround until 1.3.2?
Looks like it was fixed in 1.3.2. The test suggested by @dtretyakov now passes using Ktor 1.3.2 and Kotlin 1.3.60
Sorry for the delay. Yep, the problem was fixed with the timeout feature release.
Closed
Most helpful comment
Looks like it was fixed in 1.3.2. The test suggested by @dtretyakov now passes using Ktor 1.3.2 and Kotlin 1.3.60