pgm: Handle exceptions in Push 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: I7a5dc6b1ebaad6f7b8baa35ce68760b79bab8acd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
c821054316
commit
fa3db15049
|
@ -53,6 +53,7 @@
|
|||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.PushCommand;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.ObjectReader;
|
||||
|
@ -115,7 +116,7 @@ void nothin(@SuppressWarnings("unused") final boolean ignored) {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void run() throws Exception {
|
||||
protected void run() {
|
||||
try (Git git = new Git(db)) {
|
||||
PushCommand push = git.push();
|
||||
push.setDryRun(dryRun);
|
||||
|
@ -140,6 +141,8 @@ protected void run() throws Exception {
|
|||
printPushResult(reader, result.getURI(), result);
|
||||
}
|
||||
}
|
||||
} catch (GitAPIException | IOException e) {
|
||||
throw die(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue