Improve error message for GitDbRepoNotFoundException
This commit is contained in:
parent
18e9d51248
commit
4895350c6b
3 changed files with 6 additions and 6 deletions
|
@ -53,7 +53,7 @@ public interface GitDB {
|
|||
final Git git = Git.open(dbDir.toFile());
|
||||
return new GitDBLocal(git);
|
||||
} catch (RepositoryNotFoundException e) {
|
||||
throw new GitDbRepoNotFoundException(dbDir, e);
|
||||
throw new GitDBRepoNotFoundException(dbDir, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,14 @@ import java.nio.file.Path;
|
|||
*
|
||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||
*/
|
||||
public class GitDbRepoNotFoundException extends RuntimeException {
|
||||
public class GitDBRepoNotFoundException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param path the path that is not a valid GitDB repo
|
||||
* @param cause the original exception
|
||||
*/
|
||||
GitDbRepoNotFoundException(final Path path, final RepositoryNotFoundException cause) {
|
||||
super(cause);
|
||||
GitDBRepoNotFoundException(final Path path, final RepositoryNotFoundException cause) {
|
||||
super(String.format("GitDB repo not found: %s", path.toString()), cause);
|
||||
}
|
||||
}
|
|
@ -122,8 +122,9 @@ class GitDBTest implements WithAssertions {
|
|||
//given
|
||||
final Path dir = dirExists();
|
||||
//then
|
||||
assertThatExceptionOfType(GitDbRepoNotFoundException.class)
|
||||
assertThatExceptionOfType(GitDBRepoNotFoundException.class)
|
||||
.isThrownBy(() -> GitDB.openLocal(dir))
|
||||
.withMessageContaining("GitDB repo not found")
|
||||
.withMessageContaining(dir.toString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue