summaryrefslogtreecommitdiffstats
path: root/hosted-api
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-10-27 21:34:53 +0100
committerJon Marius Venstad <venstad@gmail.com>2020-10-27 21:34:53 +0100
commit456b4f98cfa576c63380913022f3f7d43d033dde (patch)
treea3f0298ec2fcdbdfdd64facf7fea48e553af40e1 /hosted-api
parent4d5f1ce293c680be6a0050a0a1606a902003465d (diff)
Throw more verbose exceptions, and avoid compile-version, in deploy
Diffstat (limited to 'hosted-api')
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java7
1 files changed, 5 insertions, 2 deletions
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.