Skip to content

Commit

Permalink
invert resp nil logic
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenleach committed Nov 26, 2024
1 parent 3ca9111 commit 79110c2
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions pkg/connector/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,28 @@ func (o *groupResourceType) Grants(
case resourceTypeRole.Id:
roles, resp, err := listGroupAssignedRoles(ctx, o.connector.client, groupID, nil)
if err != nil {
if resp != nil {
defer resp.Body.Close()
errOkta, err := getError(resp)
if resp == nil {
return nil, "", nil, fmt.Errorf("okta-connectorv2: failed to list group roles: %w", err)
}

defer resp.Body.Close()
errOkta, err := getError(resp)
if err != nil {
return nil, "", nil, err
}
if errOkta.ErrorCode == AccessDeniedErrorCode {
err = bag.Next("")
if err != nil {
return nil, "", nil, err
}
if errOkta.ErrorCode == AccessDeniedErrorCode {
err = bag.Next("")
if err != nil {
return nil, "", nil, err
}
pageToken, err := bag.Marshal()
if err != nil {
return nil, "", nil, err
}
return nil, pageToken, nil, nil
} else {
return nil, "", nil, fmt.Errorf("okta-connectorv2: failed to list group roles: %v", errOkta)
pageToken, err := bag.Marshal()
if err != nil {
return nil, "", nil, err
}
return nil, pageToken, nil, nil
} else {
return nil, "", nil, fmt.Errorf("okta-connectorv2: failed to list group roles: %v", errOkta)
}
return nil, "", nil, fmt.Errorf("okta-connectorv2: failed to list group roles: %w", err)
}

for _, role := range roles {
Expand Down

0 comments on commit 79110c2

Please sign in to comment.