Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: addErrMessageTooBig sentinel error for limited reads#535

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 3 commits intomasterfromdanielle/type-error-return
Sep 5, 2025

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedAug 15, 2025
edited by mafredri
Loading

This change allows detecting when a message exceeds the maximum allowed size
during reads viaerrors.Is(err, ErrMessageTooBig). Previously, this condition
required string matching against the error message. For backwards compatibility,
the old message is preserved in the error chain.

@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewAugust 15, 2025 12:07
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

Deferring approval to@mafredri

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Considering this code-path closes the connection, what use-case are we addressing by detecting the specific error?

@DanielleMaywood
Copy link
ContributorAuthor

Considering this code-path closes the connection, what use-case are we addressing by detecting the specific error?

The exact use-case is for better logging here:
https://github.com/coder/coder/blob/205eb29e60cc3b3519b4ff0247d191b0c87e4d75/codersdk/wsjson/decoder.go#L39-L41

It was previously decided to log at adebug log level. Assuming we want to keep that original behavior, but raise it for this specific error, we want to be able to match against it properly (without usingstring.Contains on the error).

mafredri reacted with thumbs up emoji

@mafredrimafredri self-assigned thisSep 1, 2025
@mafredrimafredri changed the titlerefactor: replace fmt.Errorf with MessageTooBigErrorrefactor: addErrMessageTooBig sentinel error for limited readsSep 4, 2025
@DanielleMaywoodDanielleMaywood merged commit7d7c644 intomasterSep 5, 2025
4 checks passed
@mafredrimafredri deleted the danielle/type-error-return branchSeptember 5, 2025 08:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn left review comments

@mafredrimafredrimafredri approved these changes

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@DanielleMaywood@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp