diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-20 21:04:43 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-20 22:18:40 +0100 |
commit | a6212392d56b591d75d810e347e945b3f255f937 (patch) | |
tree | bdd5e2f25842dcf0ba663dae1b245408e7483279 /org.eclipse.jgit.pgm | |
parent | b7810bf5a86bdc66d3863179843f078f56a5c09a (diff) | |
download | jgit-a6212392d56b591d75d810e347e945b3f255f937.tar.gz jgit-a6212392d56b591d75d810e347e945b3f255f937.zip |
pgm: Handle exceptions in Diff 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: Iba0e4338381519dc55c2892d95181ddfb881adf2
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/Diff.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java index 97e3df38d6..d53125d8c0 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java @@ -62,6 +62,7 @@ import org.eclipse.jgit.diff.DiffFormatter; import org.eclipse.jgit.diff.RawTextComparator; import org.eclipse.jgit.diff.RenameDetector; import org.eclipse.jgit.dircache.DirCacheIterator; +import org.eclipse.jgit.errors.RevisionSyntaxException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectReader; import org.eclipse.jgit.lib.Repository; @@ -177,7 +178,7 @@ class Diff extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { + protected void run() { diffFmt.setRepository(db); try { if (cached) { @@ -217,6 +218,8 @@ class Diff extends TextBuiltin { diffFmt.format(oldTree, newTree); diffFmt.flush(); } + } catch (RevisionSyntaxException | IOException e) { + throw die(e.getMessage(), e); } finally { diffFmt.close(); } |