summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-01-20 21:53:30 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-01-21 00:54:16 +0100
commitfa3db15049aacf9e639b18e498511817cd4e131a (patch)
treea45748384217f89a701bfb3d24086f1341f92e6e /org.eclipse.jgit.pgm
parentc821054316e81842a801697a2ff798fb863ac646 (diff)
downloadjgit-fa3db15049aacf9e639b18e498511817cd4e131a.tar.gz
jgit-fa3db15049aacf9e639b18e498511817cd4e131a.zip
pgm: Handle exceptions in Push command
This avoids we show a stacktrace on the console by default when this type of exception is thrown during the run method is executed. Change-Id: I7a5dc6b1ebaad6f7b8baa35ce68760b79bab8acd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
index be8ad374d3..faa0f51d76 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
@@ -53,6 +53,7 @@ import java.util.List;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.PushCommand;
+import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectReader;
@@ -115,7 +116,7 @@ class Push extends TextBuiltin {
/** {@inheritDoc} */
@Override
- protected void run() throws Exception {
+ protected void run() {
try (Git git = new Git(db)) {
PushCommand push = git.push();
push.setDryRun(dryRun);
@@ -140,6 +141,8 @@ class Push extends TextBuiltin {
printPushResult(reader, result.getURI(), result);
}
}
+ } catch (GitAPIException | IOException e) {
+ throw die(e.getMessage(), e);
}
}