catch repo creation errors

keep mirroring even if something fails
This commit is contained in:
leander committed 2024-10-11 15:34:16 +02:00
1 parent 51ff72e934
commit 3c39af3754
1 file changed
+6 -1
+6 -1
View File
@@ -6,6 +6,7 @@ from collections import OrderedDict
import git
from dotenv import load_dotenv
from github3 import login
from github3 import exceptions as gh_exceptions
from gitlab import Gitlab
BASE_DIR = os.path.dirname(__file__)
@@ -103,7 +104,11 @@ class Lab2Hub:
for name, gl_repo in gl_repo_data.items():
if name not in gh_repo_data:
logger.info("[NEW]: {}".format(name))
gh_repo = self.create_github_repository(name)
try:
gh_repo = self.create_github_repository(name)
except gh_exceptions.UnprocessableEntity as e:
logger.error(f"Error creating repo {name} - {e}")
continue
else:
gh_repo = gh_repo_data[name]