From 456b4f98cfa576c63380913022f3f7d43d033dde Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Tue, 27 Oct 2020 21:34:53 +0100 Subject: Throw more verbose exceptions, and avoid compile-version, in deploy --- .../src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'hosted-api/src/main') diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java index 06e2174dbb5..d074915a023 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java @@ -275,10 +275,13 @@ public abstract class ControllerHttpClient { (rootObject.field("error-code").valid() ? " (" + rootObject.field("error-code").asString() + ")" : "") + ": " + rootObject.field("message").asString(); + if (response.statusCode() == 403) + throw new IllegalArgumentException("Access denied for " + request + ": " + message); + if (response.statusCode() / 100 == 4) - throw new IllegalArgumentException(message); + throw new IllegalArgumentException("Bad request for " + request + ": " + message); - throw new IOException(message); + throw new IOException("Failed " + request + ": " + message); } catch (IOException e) { // Catches the above, and timeout exceptions from the client. -- cgit v1.2.3