diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:21:26 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:21:26 +0100 |
commit | c03700dcb044c2a58b1ca9fcec387253fe0aabd7 (patch) | |
tree | 69e82a2a634704c2bf8cadac0e0a0a4562398b46 /org.eclipse.jgit.pgm/src | |
parent | ec7ec69819f56a1c4f09a6d7f70eea090035e19b (diff) | |
download | jgit-c03700dcb044c2a58b1ca9fcec387253fe0aabd7.tar.gz jgit-c03700dcb044c2a58b1ca9fcec387253fe0aabd7.zip |
pgm: Handle GitAPIException in Repo 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: I1a636478bfae8cc0635a3e57be252126e69c19cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java index f557211fd9..eec562dc05 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java @@ -42,6 +42,7 @@ */ package org.eclipse.jgit.pgm; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.gitrepo.RepoCommand; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Option; @@ -60,11 +61,15 @@ class Repo extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { - new RepoCommand(db) - .setURI(uri) - .setPath(path) - .setGroups(groups) - .call(); + protected void run() { + try { + new RepoCommand(db) + .setURI(uri) + .setPath(path) + .setGroups(groups) + .call(); + } catch (GitAPIException e) { + throw die(e.getMessage(), e); + } } } |