pgm: Handle IOException in ShowRef 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: If18a5d8013f1cb393af3a5e5a1ec9613ac2151bd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
390fe5b878
commit
5ca4075c45
|
@ -56,15 +56,19 @@
|
||||||
class ShowRef extends TextBuiltin {
|
class ShowRef extends TextBuiltin {
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
protected void run() throws Exception {
|
protected void run() {
|
||||||
for (Ref r : getSortedRefs()) {
|
try {
|
||||||
show(r.getObjectId(), r.getName());
|
for (Ref r : getSortedRefs()) {
|
||||||
if (r.getPeeledObjectId() != null)
|
show(r.getObjectId(), r.getName());
|
||||||
show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
|
if (r.getPeeledObjectId() != null)
|
||||||
|
show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw die(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Iterable<Ref> getSortedRefs() throws Exception {
|
private Iterable<Ref> getSortedRefs() throws IOException {
|
||||||
List<Ref> all = db.getRefDatabase().getRefs();
|
List<Ref> all = db.getRefDatabase().getRefs();
|
||||||
// TODO(jrn) check if we can reintroduce fast-path by e.g. implementing
|
// TODO(jrn) check if we can reintroduce fast-path by e.g. implementing
|
||||||
// SortedList
|
// SortedList
|
||||||
|
|
Loading…
Reference in New Issue