diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:48:47 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:48:47 +0100 |
commit | 7d073c129c910f42aeabb43ce9b8ffa52a03acb5 (patch) | |
tree | d4b3adb09e057f05f43f0067cbf1211ebb729a37 /org.eclipse.jgit.pgm/src | |
parent | 88d60bf51a1c07d20bcf5f7be0ea29202dc1d9dc (diff) | |
download | jgit-7d073c129c910f42aeabb43ce9b8ffa52a03acb5.tar.gz jgit-7d073c129c910f42aeabb43ce9b8ffa52a03acb5.zip |
pgm: Handle exceptions in Tag 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: I16b528fad74d0c5346d054b3c29070331d60db7f
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/Tag.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java index 43c1f54ab5..1da4b1d261 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java @@ -48,12 +48,14 @@ package org.eclipse.jgit.pgm; +import java.io.IOException; import java.text.MessageFormat; import java.util.List; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ListTagCommand; import org.eclipse.jgit.api.TagCommand; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.RefAlreadyExistsException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; @@ -82,7 +84,7 @@ class Tag extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { + protected void run() { try (Git git = new Git(db)) { if (tagName != null) { if (delete) { @@ -115,6 +117,8 @@ class Tag extends TextBuiltin { outw.println(Repository.shortenRefName(ref.getName())); } } + } catch (GitAPIException | IOException e) { + throw die(e.getMessage(), e); } } } |