From 50b03d68dcaaad102d5a8f4c3f762bf246f61357 Mon Sep 17 00:00:00 2001 From: Haakon Dybdahl Date: Tue, 28 Feb 2017 15:17:17 +0100 Subject: Improve log message by transforming back to an exception that is more understandable. --- .../http/client/core/communication/ApacheGatewayConnection.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java index 6fae0765e14..c469b902ed2 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java @@ -268,9 +268,13 @@ class ApacheGatewayConnection implements GatewayConnection { private void verifyServerResponseCode(StatusLine statusLine) throws ServerResponseException { // We use code 261-299 to report errors related to internal transitive errors that the tenants should not care // about to avoid masking more serious errors. - if (statusLine.getStatusCode() > 199 && statusLine.getStatusCode() < 260) { + int statusCode = statusLine.getStatusCode(); + if (statusCode > 199 && statusCode < 260) { return; } + if (statusCode == 299) { + throw new ServerResponseException(429, "Too many requests."); + } throw new ServerResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); } -- cgit v1.2.3