Browse Source

pgm: Handle GitAPIException in Repo 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: I1a636478bfae8cc0635a3e57be252126e69c19cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.4
Matthias Sohn 6 years ago
parent
commit
c03700dcb0
  1. 17
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java

17
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java

@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.pgm;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.gitrepo.RepoCommand;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
@ -60,11 +61,15 @@ class Repo extends TextBuiltin {
/** {@inheritDoc} */
@Override
protected void run() throws Exception {
new RepoCommand(db)
.setURI(uri)
.setPath(path)
.setGroups(groups)
.call();
protected void run() {
try {
new RepoCommand(db)
.setURI(uri)
.setPath(path)
.setGroups(groups)
.call();
} catch (GitAPIException e) {
throw die(e.getMessage(), e);
}
}
}

Loading…
Cancel
Save