Skip to content

Commit

Permalink
Return 504 instead of 500 on connect exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hmusum committed Dec 26, 2024
1 parent 801d6d2 commit 275860d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.IOException;
import java.io.OutputStream;
import java.net.ConnectException;
import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
Expand All @@ -36,7 +37,7 @@ public HttpResponse getLogs(HttpURL logServerUri, Optional<Instant> deployTime)
HttpGet get = new HttpGet(logServerUri.asURI());
try {
return new ProxyResponse(httpClient.execute(get));
} catch (ConnectionRequestTimeoutException e) {
} catch (ConnectionRequestTimeoutException | ConnectException e) {
return new GatewayTimeoutResponse(504);
} catch (IOException e) {
if (deployTime.isPresent() && Instant.now().isBefore(deployTime.get().plus(Duration.ofMinutes(5))))
Expand Down

0 comments on commit 275860d

Please sign in to comment.