diff src/org/tmatesoft/hg/core/HgFileRevision.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 58725dd511b3
children ac8e1ce67730
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgFileRevision.java	Thu Dec 01 03:05:28 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgFileRevision.java	Thu Dec 01 05:21:40 2011 +0100
@@ -84,7 +84,7 @@
 	 * 
 	 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values.
 	 */
-	public Pair<Nodeid, Nodeid> getParents() {
+	public Pair<Nodeid, Nodeid> getParents() throws HgInvalidControlFileException {
 		if (parents == null) {
 			HgDataFile fn = repo.getFileNode(path);
 			int localRevision = fn.getLocalRevision(revision);
@@ -98,7 +98,7 @@
 		return parents;
 	}
 
-	public void putContentTo(ByteChannel sink) throws HgDataStreamException, CancelledException {
+	public void putContentTo(ByteChannel sink) throws HgDataStreamException, HgInvalidControlFileException, CancelledException {
 		HgDataFile fn = repo.getFileNode(path);
 		int localRevision = fn.getLocalRevision(revision);
 		fn.contentWithFilters(localRevision, sink);
@@ -116,6 +116,9 @@
 				}
 			}
 		} catch (HgDataStreamException ex) {
+			// FIXME rather throw an exception than log silently
+			HgInternals.getContext(repo).getLog().error(getClass(), ex, null);
+		} catch (HgInvalidControlFileException ex) {
 			HgInternals.getContext(repo).getLog().error(getClass(), ex, null);
 		}
 		isCopy = Boolean.FALSE;