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 GrpcStatus for InvalidProtocolBufferException #5554

Merged

Conversation

jaeseung-bae
Copy link
Contributor

@jaeseung-bae jaeseung-bae commented Apr 2, 2024

Motivation:

Modifications:

  • Add corner case(InvalidProtocolBufferException) handling logic that returns INVALID_ARGUMENT to give more helpful description to clients.
  • Modify rpc EchoWrappers() in transcoding.proto to accept http-post-binding in order to add integration test for type-mismatched json value
  • Add unit-test, integration-test

Result:

@CLAassistant
Copy link

CLAassistant commented Apr 2, 2024

CLA assistant check
All committers have signed the CLA.

void invalidProtocolBufferExceptionToInvalidArgumentCode() {
assertThat(GrpcStatus.fromThrowable(new InvalidProtocolBufferException("Failed to parse message")).getCode())
.isEqualTo(Status.Code.INVALID_ARGUMENT);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also add an integration test that sends invalid data described in the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll

@ikhoon ikhoon added defect sprint Issues for OSS Sprint participants labels Apr 2, 2024
@jaeseung-bae jaeseung-bae marked this pull request as ready for review April 2, 2024 12:09
@jaeseung-bae jaeseung-bae marked this pull request as draft April 2, 2024 12:10
Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.09%. Comparing base (4ca7e89) to head (f513257).

❗ Current head f513257 differs from pull request most recent head d3495d7. Consider uploading reports for the commit d3495d7 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5554      +/-   ##
============================================
- Coverage     74.11%   74.09%   -0.02%     
+ Complexity    21013    20977      -36     
============================================
  Files          1819     1819              
  Lines         77397    77307      -90     
  Branches       9889     9877      -12     
============================================
- Hits          57359    57278      -81     
+ Misses        15380    15373       -7     
+ Partials       4658     4656       -2     

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

@jaeseung-bae jaeseung-bae marked this pull request as ready for review April 2, 2024 13:44
@jaeseung-bae jaeseung-bae requested a review from ikhoon April 2, 2024 13:59
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix! 🚀🚀

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@jrhee17 jrhee17 added this to the 1.28.0 milestone Apr 8, 2024
Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

👍 👍 👍

@jrhee17 jrhee17 merged commit a13d582 into line:main Apr 8, 2024
16 checks passed
@jaeseung-bae jaeseung-bae deleted the fix/handling-invalid-protocol-buffer-exception branch April 8, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect sprint Issues for OSS Sprint participants
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grpc UNAVAILABLE status returned when calling grpc-json rpc with invalid Number (Long, Integer, ...)
5 participants