diff cmdline/org/tmatesoft/hg/console/Bundle.java @ 354:5f9073eabf06

Propagate errors with exceptions up to a end client
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 01 Dec 2011 05:21:40 +0100
parents 45dc79e545f5
children dfb8405d996f
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Bundle.java	Thu Dec 01 03:05:28 2011 +0100
+++ b/cmdline/org/tmatesoft/hg/console/Bundle.java	Thu Dec 01 05:21:40 2011 +0100
@@ -19,6 +19,8 @@
 import java.io.File;
 import java.util.Collections;
 
+import org.tmatesoft.hg.core.HgCallbackTargetException;
+import org.tmatesoft.hg.core.HgException;
 import org.tmatesoft.hg.core.Nodeid;
 import org.tmatesoft.hg.repo.HgBundle;
 import org.tmatesoft.hg.repo.HgChangelog;
@@ -57,12 +59,16 @@
 			private final HgChangelog changelog = hgRepo.getChangelog();
 			
 			public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) {
-				if (changelog.isKnown(nodeid)) {
-					System.out.print("+");
-				} else {
-					System.out.print("-");
+				try {
+					if (changelog.isKnown(nodeid)) {
+						System.out.print("+");
+					} else {
+						System.out.print("-");
+					}
+					System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString());
+				} catch (HgException ex) {
+					throw new HgCallbackTargetException.Wrap(ex);
 				}
-				System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString());
 			}
 		});
 	}