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 panic on zero send from server #398

Merged
merged 4 commits into from
Nov 18, 2022
Merged

Fix panic on zero send from server #398

merged 4 commits into from
Nov 18, 2022

Conversation

joshcarp
Copy link
Contributor

  • Maps a zero code of connectWireError to a CodeUnknown in connectWireError) asError() *Error
    This could have been done in the unmarshaling to connectWireError but I chose to leave that to be exactly what was read off the wire.
  • Adds nil guard in validateResponse for asError
  • Adds tests for error mapping

Fixes: https://github.com/bufbuild/connect-go/issues/396

@joshcarp joshcarp requested review from pkwarren and akshayjshah and removed request for pkwarren November 18, 2022 15:20
protocol_connect.go Outdated Show resolved Hide resolved
Copy link
Member

@akshayjshah akshayjshah left a comment

Choose a reason for hiding this comment

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

Let's be more aggressive about mapping out-of-range codes to CodeUnknown. Otherwise, LGTM - thanks for the fix Josh!

client_ext_test.go Outdated Show resolved Hide resolved
protocol_connect.go Outdated Show resolved Hide resolved
@joshcarp joshcarp merged commit 8e45b51 into main Nov 18, 2022
@joshcarp joshcarp deleted the fix/panic-on-zero branch November 18, 2022 21:32
akshayjshah pushed a commit that referenced this pull request Jul 26, 2023
- Maps a zero code of `connectWireError` to a CodeUnknown in
`connectWireError) asError() *Error `
This could have been done in the unmarshaling to `connectWireError` but
I chose to leave that to be exactly what was read off the wire.
- Adds nil guard in `validateResponse` for asError
- Adds tests for error mapping

Fixes: https://github.com/bufbuild/connect-go/issues/396
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.

Client panic when server sends 0 connect.ErrorCode
3 participants