Skip to content

Commit

Permalink
Fix KeyError with user query result
Browse files Browse the repository at this point in the history
The return object could be dictionary when failed auth, which could
cause the KeyError exception. Fix it by also catch the KeyError.

Signed-off-by: Wayne Sun <gsun@redhat.com>
  • Loading branch information
waynesun09 authored and sandrobonazzola committed Jul 11, 2024
1 parent abb91b8 commit 4cd5acf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion did/plugins/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_user(self, username):
) from jde
try:
return result[0]
except IndexError:
except (IndexError, KeyError):
raise ReportError(
"Unable to find user '{0}' on GitLab.".format(username))

Expand Down

0 comments on commit 4cd5acf

Please sign in to comment.