Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 422:5d1cc7366d04 | 423:9c9c442b5f2e |
|---|---|
| 16 */ | 16 */ |
| 17 package org.tmatesoft.hg.repo; | 17 package org.tmatesoft.hg.repo; |
| 18 | 18 |
| 19 import java.io.File; | 19 import java.io.File; |
| 20 | 20 |
| 21 import org.tmatesoft.hg.core.HgBadStateException; | 21 import org.tmatesoft.hg.core.HgRepositoryNotFoundException; |
| 22 import org.tmatesoft.hg.core.HgInvalidFileException; | |
| 23 import org.tmatesoft.hg.internal.Experimental; | 22 import org.tmatesoft.hg.internal.Experimental; |
| 24 import org.tmatesoft.hg.util.Path; | 23 import org.tmatesoft.hg.util.Path; |
| 25 | 24 |
| 26 /** | 25 /** |
| 27 * WORK IN PROGRESS, DO NOT USE | 26 * WORK IN PROGRESS, DO NOT USE |
| 84 | 83 |
| 85 public HgRepository getOwner() { | 84 public HgRepository getOwner() { |
| 86 return owner; | 85 return owner; |
| 87 } | 86 } |
| 88 | 87 |
| 89 public HgRepository getRepo() throws HgInvalidFileException { | 88 /** |
| 89 * | |
| 90 * @return object to access sub-repository | |
| 91 * @throws HgRepositoryNotFoundException if failed to find repository | |
| 92 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> | |
| 93 */ | |
| 94 public HgRepository getRepo() throws HgRepositoryNotFoundException { | |
| 90 if (kind != Kind.Hg) { | 95 if (kind != Kind.Hg) { |
| 91 throw new HgBadStateException(String.format("Unsupported subrepository %s", kind)); | 96 throw new HgInvalidStateException(String.format("Unsupported subrepository %s", kind)); |
| 92 } | 97 } |
| 93 return new HgLookup().detect(new File(owner.getWorkingDir(), source)); | 98 return new HgLookup().detect(new File(owner.getWorkingDir(), source)); |
| 94 } | 99 } |
| 95 } | 100 } |
