diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:17:00 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:19:54 +0100 |
commit | d8fec824e4f81dbae5bb72046560452cd19b319d (patch) | |
tree | b6f4ba0cd7547a7d83ea4298b83ebd2b0d936fee /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm | |
parent | 8615c042ffd70ea8fec2dfd746279691ace74205 (diff) | |
download | jgit-d8fec824e4f81dbae5bb72046560452cd19b319d.tar.gz jgit-d8fec824e4f81dbae5bb72046560452cd19b319d.zip |
pgm: Handle exceptions in Reflog 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: Id25eb523c12c07cbd14e31edfb8b5d7ec9b3ccf3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java index 6f4fcc2488..410e88fdee 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java @@ -42,10 +42,12 @@ */ package org.eclipse.jgit.pgm; +import java.io.IOException; import java.util.Collection; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ReflogCommand; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ReflogEntry; import org.eclipse.jgit.lib.Repository; @@ -59,7 +61,7 @@ class Reflog extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { + protected void run() { try (Git git = new Git(db)) { ReflogCommand cmd = git.reflog(); if (ref != null) @@ -69,6 +71,8 @@ class Reflog extends TextBuiltin { for (ReflogEntry entry : entries) { outw.println(toString(entry, i++)); } + } catch (GitAPIException | IOException e) { + throw die(e.getMessage(), e); } } |