Unverified Commit 8769c3c9 authored by Jonah Brüchert's avatar Jonah Brüchert
Browse files

Add error message if the repository was not found

parent 4dea5ae2
......@@ -14,7 +14,7 @@ from urllib.parse import urlparse
from gitlab import Gitlab
from gitlab.v4.objects import Project
from gitlab.exceptions import GitlabAuthenticationError, GitlabGetError
from gitlab.exceptions import GitlabAuthenticationError, GitlabGetError, GitlabHttpError
from git import Repo
from lab.utils import Utils, LogType
......@@ -69,9 +69,14 @@ class RepositoryConnection:
Utils.log(LogType.Error, "Failed to connect to GitLab")
sys.exit(1)
self._remote_project = self._connection.projects.get(
Utils.str_id_for_url(Utils.normalize_url(repository))
)
try:
self._remote_project = self._connection.projects.get(
Utils.str_id_for_url(Utils.normalize_url(repository))
)
except (GitlabHttpError, GitlabGetError):
Utils.log(LogType.Error, "The repository could not be found on the GitLab instance.")
print("If the repository was recently moved, please update the origin remote using git.")
exit(1)
def __login(self, hostname: str, token: str) -> None:
try:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment