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>
This commit is contained in:
Matthias Sohn 2019-01-21 23:19:32 +01:00
parent d8fec824e4
commit ec7ec69819
1 changed files with 3 additions and 1 deletions

View File

@ -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 @@ protected void run() throws Exception {
throw new JGitInternalException(MessageFormat
.format(CLIText.get().unknownSubcommand, command));
}
} catch (Exception e) {
throw die(e.getMessage(), e);
}
}