Skip to content

Commit

Permalink
better handling of exceptions, again
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Sep 14, 2024
1 parent b2bb20a commit e08d9dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions autoupdate_app_sources/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def changelog_for_ref(self, new_ref: str, old_ref: str, ref_type: RefType) -> st
class GitlabAPI:
def __init__(self, upstream: str):
# Find gitlab api root...
upstream = upstream.rstrip("/")
self.forge_root = self.get_forge_root(upstream).rstrip("/")
self.project_path = upstream.replace(self.forge_root, "").lstrip("/")
self.project_id = self.find_project_id(self.project_path)
Expand Down
10 changes: 7 additions & 3 deletions find_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ def upstream_last_update_ago(app: str) -> tuple[str, int | None]:
api = None
try:
if upstream.startswith("https://github.com/"):
api = GithubAPI(upstream, auth=get_github()[0])
try:
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)

if upstream.startswith("https://codeberg.org") or upstream.startswith("https://framagit.org"):
if upstream.startswith("https://codeberg.org"):
api = GiteaForgejoAPI(upstream)

if not api:
Expand Down

0 comments on commit e08d9dd

Please sign in to comment.