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

Improve error response handling #386

Merged
merged 2 commits into from Nov 16, 2022
Merged

Improve error response handling #386

merged 2 commits into from Nov 16, 2022

Conversation

awilliams-fastly
Copy link
Collaborator

@awilliams-fastly awilliams-fastly commented Nov 15, 2022

Instead of panic'ing when an error response cannot be decoded from JSON, return a generic error which includes the read portion of the response body.

Followup to @dgryski's comment: #367 (comment)

Instead of panic'ing when an error response cannot be decoded from JSON,
return a generic error which includes the read portion of the response
body.

Followup to @dgryski's comment:
#367 (comment)
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

I'd like more details on what the error message improvement is from keeping the entire body in memory.

fastly/errors.go Show resolved Hide resolved
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

One more question for the error text, but once that's resolved we're good to go.

fastly/errors.go Show resolved Hide resolved
Provide context for why the response's body is included in the error
message and the decode error is not.
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

LGTM

@awilliams-fastly awilliams-fastly merged commit 400d150 into main Nov 16, 2022
@awilliams-fastly awilliams-fastly deleted the awilliams/no-panic branch November 16, 2022 21:28
@Integralist Integralist added the enhancement New feature or request label Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants