Skip to content

Commit

Permalink
Merge pull request #14 from ConductorOne/mchavez-baton-cloudflare-fix…
Browse files Browse the repository at this point in the history
…-bug

Handle case of resp possibly being nil due to network error
  • Loading branch information
ggreer authored Jul 30, 2024
2 parents 16c302a + 1547e5f commit ad2e0e8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/connector/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,17 @@ func (r *roleResourceType) UpdateAccountMember(ctx context.Context, accountID, m

resp, err := r.httpClient.Do(req, uhttp.WithJSONResponse(&accountMemberListResponse))
if err != nil {
return nil, &CloudflareError{
ce := &CloudflareError{
ErrorMessage: err.Error(),
ErrorDescription: err.Error(),
ErrorCode: resp.StatusCode,
ErrorSummary: fmt.Sprint(resp.Body),
ErrorLink: endpointUrl,
}
if resp != nil {
ce.ErrorCode = resp.StatusCode
ce.ErrorSummary = fmt.Sprint(resp.Body)
}

return nil, ce
}

defer resp.Body.Close()
Expand Down

0 comments on commit ad2e0e8

Please sign in to comment.