1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

better handling of exceptions, again

This commit is contained in:
Salamandar 2024-03-09 15:47:01 +01:00
parent 6de9fa7f09
commit a94b1d474b
2 changed files with 8 additions and 3 deletions

View file

@ -66,6 +66,7 @@ class GithubAPI:
class GitlabAPI: class GitlabAPI:
def __init__(self, upstream: str): def __init__(self, upstream: str):
# Find gitlab api root... # Find gitlab api root...
upstream = upstream.rstrip("/")
self.forge_root = self.get_forge_root(upstream).rstrip("/") self.forge_root = self.get_forge_root(upstream).rstrip("/")
self.project_path = upstream.replace(self.forge_root, "").lstrip("/") self.project_path = upstream.replace(self.forge_root, "").lstrip("/")
self.project_id = self.find_project_id(self.project_path) self.project_id = self.find_project_id(self.project_path)

View file

@ -60,12 +60,16 @@ def upstream_last_update_ago(app: str) -> tuple[str, int | None]:
api = None api = None
try: try:
if upstream.startswith("https://github.com/"): if upstream.startswith("https://github.com/"):
try:
api = GithubAPI(upstream, auth=get_github()[0]) api = GithubAPI(upstream, auth=get_github()[0])
except AssertionError as e:
logging.error(f"Exception while handling {app}: {e}")
return app, None
if upstream.startswith("https://gitlab."): if upstream.startswith("https://gitlab.") or upstream.startswith("https://framagit.org"):
api = GitlabAPI(upstream) api = GitlabAPI(upstream)
if upstream.startswith("https://codeberg.org") or upstream.startswith("https://framagit.org"): if upstream.startswith("https://codeberg.org"):
api = GiteaForgejoAPI(upstream) api = GiteaForgejoAPI(upstream)
if not api: if not api: