summaryrefslogtreecommitdiffstats
path: root/vespa-maven-plugin
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-11-20 12:01:10 +0100
committerJon Marius Venstad <venstad@gmail.com>2020-11-20 12:01:10 +0100
commit80b29f6cf9c1885a2d3864f27d319054d683e00f (patch)
tree9c452a25dfea449e2026e2e8764c0692ac63f425 /vespa-maven-plugin
parent1f65e089ab875952bea5914b9630360145d92b9f (diff)
Add URL and more logging when controller http client fails
Diffstat (limited to 'vespa-maven-plugin')
-rw-r--r--vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java
index 8cfbfd204ba..7119bde7a09 100644
--- a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java
+++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java
@@ -4,6 +4,7 @@ package ai.vespa.hosted.plugin;
import ai.vespa.hosted.api.ControllerHttpClient;
import ai.vespa.hosted.api.Properties;
import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.yolean.Exceptions;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -15,6 +16,10 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.joining;
/**
* Base class for hosted Vespa plugin mojos.
@@ -61,7 +66,11 @@ public abstract class AbstractVespaMojo extends AbstractMojo {
throw e;
}
catch (Exception e) {
- throw new MojoExecutionException("Execution failed for application " + name(), e);
+ String message = "Execution failed for application " + name() + ":\n" + Exceptions.toMessageString(e);
+ if (e.getSuppressed().length > 0)
+ message += "\nSuppressed:\n" + Stream.of(e.getSuppressed()).map(Exceptions::toMessageString).collect(joining("\n"));
+
+ throw new MojoExecutionException(message, e);
}
}