diff src/org/tmatesoft/hg/repo/HgSubrepoLocation.java @ 423:9c9c442b5f2e

Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 23 Mar 2012 22:51:18 +0100
parents 2747b0723867
children 6865eb742883
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgSubrepoLocation.java	Fri Mar 23 21:26:01 2012 +0100
+++ b/src/org/tmatesoft/hg/repo/HgSubrepoLocation.java	Fri Mar 23 22:51:18 2012 +0100
@@ -18,8 +18,7 @@
 
 import java.io.File;
 
-import org.tmatesoft.hg.core.HgBadStateException;
-import org.tmatesoft.hg.core.HgInvalidFileException;
+import org.tmatesoft.hg.core.HgRepositoryNotFoundException;
 import org.tmatesoft.hg.internal.Experimental;
 import org.tmatesoft.hg.util.Path;
 
@@ -86,9 +85,15 @@
 		return owner;
 	}
 
-	public HgRepository getRepo() throws HgInvalidFileException {
+	/**
+	 * 
+	 * @return object to access sub-repository
+	 * @throws HgRepositoryNotFoundException if failed to find repository
+	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
+	 */
+	public HgRepository getRepo() throws HgRepositoryNotFoundException {
 		if (kind != Kind.Hg) {
-			throw new HgBadStateException(String.format("Unsupported subrepository %s", kind));
+			throw new HgInvalidStateException(String.format("Unsupported subrepository %s", kind));
 		}
 		return new HgLookup().detect(new File(owner.getWorkingDir(), source));
 	}