pgm: Handle GitAPIException in Add 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: I02940bdc1645c1d5e0abeeb4f1bafde1b8c54a1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-01-16 18:02:07 +01:00
parent 137e91a465
commit cced939504
1 changed files with 3 additions and 0 deletions

View File

@ -48,6 +48,7 @@
import org.eclipse.jgit.api.AddCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
@ -69,6 +70,8 @@ protected void run() throws Exception {
for (String p : filepatterns)
addCmd.addFilepattern(p);
addCmd.call();
} catch (GitAPIException e) {
throw die(e.getMessage(), e);
}
}
}