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 body on unwanted status codes #2

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Return body on unwanted status codes #2

merged 2 commits into from
Jan 30, 2025

Conversation

Fank
Copy link
Member

@Fank Fank commented Jan 30, 2025

This pull request includes changes to improve error handling in the contacts.go file by adding more detailed error information and updating the Error struct in error.go.

Improvements to error handling:

  • contacts.go: Added the io package to the import list to enable reading the response body in case of an error.
  • contacts.go: Updated the ContactCreate function to read the response body and include it in the error message if the status code is not http.StatusCreated. This provides more context for debugging.

Updates to Error struct:

  • error.go: Added a Body field to the Error struct to store the response body when an error occurs, allowing for more detailed error information.

@Fank Fank self-assigned this Jan 30, 2025
@Mugetsu35 Mugetsu35 merged commit 7078ac4 into master Jan 30, 2025
5 checks passed
@Mugetsu35 Mugetsu35 deleted the fk_error_body branch January 30, 2025 11:00
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.

2 participants