Improve 404 handling

This commit is contained in:
Hugh Nimmo-Smith 2022-10-17 12:32:40 +01:00
parent 1976451c81
commit eb30ef166a

View file

@ -75,7 +75,9 @@ class SimpleHttpRendezvousTransport(override var onCancelled: ((reason: Rendezvo
val response = httpClient.newCall(request.build()).execute() val response = httpClient.newCall(request.build()).execute()
if (response.code == 404) { if (response.code == 404) {
// we set to unknown and the cancel method will rewrite the reason to expired if applicable
cancel(RendezvousFailureReason.Unknown) cancel(RendezvousFailureReason.Unknown)
return
} }
etag = response.header("etag") etag = response.header("etag")
@ -116,7 +118,8 @@ class SimpleHttpRendezvousTransport(override var onCancelled: ((reason: Rendezvo
try { try {
// expired // expired
if (response.code == 404) { if (response.code == 404) {
cancel(RendezvousFailureReason.Expired) // we set to unknown and the cancel method will rewrite the reason to expired if applicable
cancel(RendezvousFailureReason.Unknown)
return null return null
} }