mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 02:31:14 +01:00
Use meaningful exception
This commit is contained in:
@@ -35,6 +35,7 @@ package sonia.scm.repository.xml;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import sonia.scm.NotFoundException;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.repository.InitialRepositoryLocationResolver;
|
||||
@@ -51,6 +52,8 @@ import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@@ -187,7 +190,7 @@ public class XmlRepositoryDAO
|
||||
return p.getId();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("could not find repository for directory: " + path);
|
||||
throw new NotFoundException("directory", path.getPath());
|
||||
}
|
||||
|
||||
private Path toRealPath(Path path) {
|
||||
@@ -196,7 +199,7 @@ public class XmlRepositoryDAO
|
||||
// (see issue #82, https://bitbucket.org/sdorra/scm-manager/issues/82/symbolic-link-in-hg-repository-path)
|
||||
return path.toRealPath();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("could not get Path$toRealPath for path: " + path);
|
||||
throw new InternalRepositoryException(entity("directory", path.toString()), "could not get Path$toRealPath for path: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user