Skip to content

Commit

Permalink
Handle connection error fetching gitlab user
Browse files Browse the repository at this point in the history
Handle more gracefully connection issues while looking up for a user on
GitLab. Previously only a traceback was generated, now an application
error is printed on the screen.
Observed during https://gitlab.gnome.org/ outage

Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
  • Loading branch information
sandrobonazzola committed Sep 20, 2023
1 parent e1e3de7 commit ca88b71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion did/plugins/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ def _get_gitlab_api_list(

def get_user(self, username):
query = 'users?username={0}'.format(username)
result = self._get_gitlab_api_json(query)
try:
result = self._get_gitlab_api_json(query)
except requests.exceptions.JSONDecodeError as jde:
raise ReportError(
f"Unable to query user '{username}' on {self.url}."
) from jde
try:
return result[0]
except IndexError:
Expand Down

0 comments on commit ca88b71

Please sign in to comment.