From ec7ec69819f56a1c4f09a6d7f70eea090035e19b Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 21 Jan 2019 23:19:32 +0100 Subject: 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 --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'org.eclipse.jgit.pgm/src') diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java index efd61fae16..58138fa03b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java +++ b/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); } } -- cgit v1.2.3