Skip to content

Commit

Permalink
Keycloak: raise Exception if group isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
NotActuallyTerry committed May 28, 2024
1 parent 4554b7a commit baac1ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion githubapp/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def get_group_id(client: KeycloakAdmin = None):
"""
group = client.get_groups(query={"search": group_name})
group = client.get_groups(query={"search": group_name, "briefRepresentation": "true", "exact": "true"})
return group[0]["id"]
try:
return group[0]["id"]
except IndexError as e:
raise Exception(f"Cannot find group {group_name} in Keycloak")

def get_members(client: KeycloakAdmin = None, group_id: str = None):
"""
Expand Down

0 comments on commit baac1ad

Please sign in to comment.