]> source.dussan.org Git - jgit.git/commitdiff
pgm: Handle GitAPIException in Fetch command 01/135201/3
authorMatthias Sohn <matthias.sohn@sap.com>
Wed, 16 Jan 2019 17:02:39 +0000 (18:02 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 20 Jan 2019 00:23:27 +0000 (01:23 +0100)
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: I043838143df7280351186ee1bcca4d1cc4832257
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

index 61fd521b8084b73a3c009cb794b933a2ebccda4a..846879388e52180167ad6e934bbf91af04236b78 100644 (file)
@@ -51,6 +51,7 @@ import java.util.List;
 
 import org.eclipse.jgit.api.FetchCommand;
 import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.SubmoduleConfig.FetchRecurseSubmodulesMode;
 import org.eclipse.jgit.lib.TextProgressMonitor;
@@ -168,6 +169,8 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback {
                                return;
 
                        showFetchResult(result);
+               } catch (GitAPIException e) {
+                       throw die(e.getMessage(), e);
                }
        }