Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return nil instead of resp on error #278

Merged
merged 2 commits into from
Mar 7, 2021
Merged

return nil instead of resp on error #278

merged 2 commits into from
Mar 7, 2021

Conversation

blockpane
Copy link
Contributor

@blockpane blockpane commented Feb 20, 2021

Prevent nil reference on error, resolves #274

event.go Outdated
@@ -49,7 +49,7 @@ func CreateEventWithHTTPClient(e Event, client HTTPClient) (*EventResponse, erro
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
return &EventResponse{HttpStatus: resp.StatusCode}, err
return nil, fmt.Errorf("failed to action request: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to go fmt this file? Just noticed the whitespace before nil when getting ready to merge.

@theckman theckman added this to the v1.4.0 milestone Feb 23, 2021
@theckman
Copy link
Collaborator

@blockpane wanted to ping again to see if you had a moment to remove the leading whitespace on your change. If not give me a shout.

@blockpane
Copy link
Contributor Author

@theckman Sorry, just caught this request, should be fixed.

@theckman theckman merged commit 4d8ea2c into PagerDuty:master Mar 7, 2021
@theckman
Copy link
Collaborator

theckman commented Mar 7, 2021

@blockpane thank you for this contribution. It'll probably still be a few days until v1.4.0 is out, and it'll be included there.

If you or anyone else is running into issues with this actively, please give us a shout via a GitHub issue and I can work on backporting just that change as v1.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreateEventWithHTTPClient nil pointer dereference
2 participants