Browse Source

pgm: Handle exceptions in Remote 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: Ie1985c2570213217c2ea0f376ff99d19bfed4e0c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.4
Matthias Sohn 6 years ago
parent
commit
ec7ec69819
  1. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java

@ -87,7 +87,7 @@ class Remote extends TextBuiltin {
/** {@inheritDoc} */
@Override
protected void run() throws Exception {
protected void run() {
try (Git git = new Git(db)) {
if (command == null) {
RemoteListCommand cmd = git.remoteList();
@ -142,6 +142,8 @@ class Remote extends TextBuiltin {
throw new JGitInternalException(MessageFormat
.format(CLIText.get().unknownSubcommand, command));
}
} catch (Exception e) {
throw die(e.getMessage(), e);
}
}

Loading…
Cancel
Save