diff options
Diffstat (limited to 'hosted-api')
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 7 |
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. |