diff src/org/tmatesoft/hg/repo/HgBundle.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 694ebabb5cb3
children dfb8405d996f
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgBundle.java	Thu Dec 01 03:05:28 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgBundle.java	Thu Dec 01 05:21:40 2011 +0100
@@ -21,6 +21,7 @@
 import java.util.LinkedList;
 
 import org.tmatesoft.hg.core.HgBadStateException;
+import org.tmatesoft.hg.core.HgCallbackTargetException;
 import org.tmatesoft.hg.core.HgException;
 import org.tmatesoft.hg.core.HgInvalidFileException;
 import org.tmatesoft.hg.core.Nodeid;
@@ -93,7 +94,7 @@
 	 * @param hgRepo repository that shall possess base revision for this bundle
 	 * @param inspector callback to get each changeset found 
 	 */
-	public void changes(final HgRepository hgRepo, final HgChangelog.Inspector inspector) throws HgInvalidFileException {
+	public void changes(final HgRepository hgRepo, final HgChangelog.Inspector inspector) throws HgCallbackTargetException, HgInvalidFileException {
 		Inspector bundleInsp = new Inspector() {
 			DigestHelper dh = new DigestHelper();
 			boolean emptyChangelog = true;
@@ -177,7 +178,11 @@
 			public void fileEnd(String name) {}
 
 		};
-		inspectChangelog(bundleInsp);
+		try {
+			inspectChangelog(bundleInsp);
+		} catch (RuntimeException ex) {
+			throw new HgCallbackTargetException(ex);
+		}
 	}
 
 	public void dump() throws HgException {