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

fix: bug where we could error after writing a status code #224

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

TylerHelmuth
Copy link
Contributor

@TylerHelmuth TylerHelmuth commented Dec 8, 2023

Which problem is this PR solving?

  • WriteOtlpHttpResponse did a no-no where it could return an error after writing a status code to the Writer. This makes it really hard for users to know the state of their Writer once the call to WriteOtlpHttpResponse ends.

Short description of the changes

  • Update function order to no longer error once we've written a status code.
  • Updates the comments.

@TylerHelmuth TylerHelmuth requested a review from a team as a code owner December 8, 2023 21:29
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

I almost caught this in the previous review. I was looking at example code and noticed that even the Go authors never looked at the error value from Write...but didn't think it through all the way.

Good catch!

@TylerHelmuth TylerHelmuth merged commit 199bedb into main Dec 8, 2023
@TylerHelmuth TylerHelmuth deleted the tyler.reorder-http-response-writing branch December 8, 2023 21:40
@JamieDanielson JamieDanielson added type: bug Something isn't working version: bump patch A PR with release-worthy changes and is backwards-compatible. labels Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working version: bump patch A PR with release-worthy changes and is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants