pgm: Handle exceptions in LsFiles 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: I7d71e194f0a7e4180094a9b36dbb55dd90c9722e
This commit is contained in:
parent
5739d1b314
commit
1978f180a2
|
@ -48,11 +48,13 @@
|
|||
import static org.eclipse.jgit.lib.FileMode.REGULAR_FILE;
|
||||
import static org.eclipse.jgit.lib.FileMode.SYMLINK;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jgit.dircache.DirCacheIterator;
|
||||
import org.eclipse.jgit.errors.RevisionSyntaxException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.FileMode;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
|
@ -72,7 +74,7 @@ class LsFiles extends TextBuiltin {
|
|||
private List<String> paths = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void run() throws Exception {
|
||||
protected void run() {
|
||||
try (RevWalk rw = new RevWalk(db);
|
||||
TreeWalk tw = new TreeWalk(db)) {
|
||||
final ObjectId head = db.resolve(Constants.HEAD);
|
||||
|
@ -96,6 +98,8 @@ protected void run() throws Exception {
|
|||
QuotedString.GIT_PATH.quote(tw.getPathString()));
|
||||
}
|
||||
}
|
||||
} catch (RevisionSyntaxException | IOException e) {
|
||||
throw die(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue