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

Changed encoding/decoding error code to from InvalidArgument to Internal #2251

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

biosvs
Copy link
Collaborator

@biosvs biosvs commented Mar 15, 2024

Functions newClientEncodingError and newServerEncodingError are called only when encoding/decoding attempt is failed, which means that either structure can't be transformed into bytes, or bytes can't be read into structure.

Currently such errors lead to CodeInvalidArgument (3) return code.

As yarpc error codes relates to grpc error codes, we may assume that meaning is also close (if not the same). In grpc-go source code the same encoding/decoding errors lead to CodeInternal code (1, 2), and so the same code should be returned in yarpc.

This PR changes CodeInvalidArgument (3) to CodeInternal(13) for most such cases.

Except for server decoding errors. If server can't decode body or header of the request, it indeed indicates that client tries to send something unexpected. (This is a change from previous review.)

It's an API change, but in a worst case we expect to have more visibility on problems that were hidden by "client errors".

@AllenLuUber AllenLuUber changed the title Changed encoding/decoding error code Changed encoding/decoding error code to from InvalidArgument to Internal Mar 19, 2024
Signed-off-by: Vitalii Levitskii <vitalii@uber.com>
@biosvs
Copy link
Collaborator Author

biosvs commented Apr 30, 2024

I revisited code and tests, and revert changes for server decoding: those errors indeed indicates that client sends invalid request.

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.21%. Comparing base (31f4083) to head (61cb8b7).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2251      +/-   ##
==========================================
- Coverage   85.25%   85.21%   -0.04%     
==========================================
  Files         270      270              
  Lines       15573    15575       +2     
==========================================
- Hits        13277    13273       -4     
- Misses       1875     1878       +3     
- Partials      421      424       +3     
Flag Coverage Δ
85.21% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@biosvs biosvs added this to the v1.73.3 milestone Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants