Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
check error before response nil
Browse files Browse the repository at this point in the history
  • Loading branch information
sbose78 committed Jan 23, 2018
1 parent e9c93e6 commit 37b3c4a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions auth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func GetSpaceCollaborators(ctx context.Context, client *api.Client, spaceID uuid
pageLimit := 100
pageOffset := "0"
resp, err := client.ListCollaborators(goasupport.ForwardContextRequestID(ctx), api.ListCollaboratorsPath(spaceID), &pageLimit, &pageOffset, nil, nil)
if err != nil {
return nil, err
}
if resp != nil {
defer resp.Body.Close()
} else {
Expand All @@ -43,9 +46,5 @@ func GetSpaceCollaborators(ctx context.Context, client *api.Client, spaceID uuid
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("non %v status code for %v, returned %v", http.StatusOK, "GET collaborators", resp.StatusCode)
}

if err != nil {
return nil, err
}
return client.DecodeUserList(resp)
}

0 comments on commit 37b3c4a

Please sign in to comment.