Repository navigation
fix: Keep the write error in the chain of Encoder errors - #81
Merged
Merged
Conversation
Encoder formatted the underlying write error with %v, which turns it into text. A caller could not use errors.Is or errors.As on the result, so it could not tell a write deadline cut (os.ErrDeadlineExceeded) from a reset or a broken pipe without matching the message. The error now wraps with %w. The message text is unchanged.
keelerm84
marked this pull request as ready for review
October 6, 2026 14:08
joker23
approved these changes
Oct 7, 2026
keelerm84
pushed a commit
that referenced
this pull request
Oct 7, 2026
🤖 I have created a release *beep* *boop* --- ## [1.14.1](v1.14.0...v1.14.1) (2026-10-07) ### Bug Fixes * Keep the write error in the chain of Encoder errors ([#81](#81)) ([49bd77d](49bd77d)) * **test:** Stop TestServerHandlesLoadsOfPendingTasks deadlocking ([#76](#76)) ([d51d9b0](d51d9b0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Encoder formatted the underlying write error with %v, which turns it into
text. A caller could not use errors.Is or errors.As on the result, so it
could not tell a write deadline cut (os.ErrDeadlineExceeded) from a reset
or a broken pipe without matching the message. The error now wraps with
%w. The message text is unchanged.
Note
Overview
Encoder write failures now preserve the underlying error so callers can use
errors.Is/errors.As(e.g. to distinguishos.ErrDeadlineExceededfrom connection resets) instead of parsing the message string.All
Encodepaths that return"eventsource encode: …"now wrap theio.WriteStringerror with%winstead of%v; the user-facing message text is unchanged.Adds
TestEncoderKeepsTheWriteErrorInTheChain, covering plain events, comments, and gzip-compressed encoding via a stub writer that always fails.Reviewed by Cursor Bugbot for commit 8f0b29d. Bugbot is set up for automated code reviews on this repo. Configure here.