diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-10-11 09:47:30 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-10-11 09:47:30 +0200 |
commit | 1e95910431b64e2c0653c5a1a2f0be5e40141544 (patch) | |
tree | 79866b6129365ab85fc39a54f0256c3ffd4a34e2 | |
parent | 28913b4f7dc9597966c6e93f1a77af923549eea2 (diff) |
Direct user to console when application does not exist or is forbidden
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 4 | ||||
-rw-r--r-- | vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java | 9 |
2 files changed, 11 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 6a339c41034..1947930285c 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 @@ -230,8 +230,8 @@ public abstract class ControllerHttpClient { Inspector rootObject = toSlime(response.body()).get(); String message = response.request() + " returned code " + response.statusCode() + - " (" + rootObject.field("error-code").asString() + "): " + - rootObject.field("message").asString(); + (rootObject.field("error-code").valid() ? " (" + rootObject.field("error-code").asString() + ")" : "") + + ": " + rootObject.field("message").asString(); if (response.statusCode() / 100 == 4) throw new IllegalArgumentException(message); diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java index db4d7a4c522..210151c450d 100644 --- a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java +++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java @@ -37,6 +37,15 @@ public class DeployMojo extends AbstractVespaDeploymentMojo { @Override protected void doExecute() throws MojoFailureException, MojoExecutionException { + try { + controller.compileVersion(id); + } + catch (IllegalArgumentException e) { + throw new MojoFailureException( "The application " + id.tenant() + "." + id.application() + " does not exist, " + + "or you do not have the required privileges to access it; " + + "please visit the Vespa cloud web UI and make sure the application exists and you have access!"); + } + loggable = DeploymentLog.Level.valueOf(vespaLogLevel); Deployment deployment = Deployment.ofPackage(Paths.get(firstNonBlank(applicationZip, projectPathOf("target", "application.zip")))); |