diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index f397b7c..e7b4a9a 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -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): """