-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Use status package for error and introduce WithProtoErrorHandler option #378
Merged
Conversation
This file contains 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
@kazegusuri thanks for this! this looks great. It looks like your generated swagger/openapi is a bit out of date. |
It was actually caused by using newer version of protoc v3.3.0. I regenerated files with protoc v3.1.0. |
Hi, we would like to see this pr merged. The new status stuff looks great! |
ready to be merged if no one opposes the response status. |
tmc
pushed a commit
to tmc/grpc-gateway
that referenced
this pull request
May 12, 2017
…on (grpc-ecosystem#378) * use status package instead of depreated method * use status package for genereated files * use status package instead of depreated method * add custome error handler to handle error as status proto * pass port number explicitly * add OtherErrorHandler tests * add ProtoErrorHandler test * regenerate go files
Closed
adasari
pushed a commit
to adasari/grpc-gateway
that referenced
this pull request
Apr 9, 2020
…on (grpc-ecosystem#378) * use status package instead of depreated method * use status package for genereated files * use status package instead of depreated method * add custome error handler to handle error as status proto * pass port number explicitly * add OtherErrorHandler tests * add ProtoErrorHandler test * regenerate go files
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.
grpc-go introduced status package to handle errors with concrete types instead of interface and obsoleted some functions like grpc.Errorf.
First, this PR changed code to use status package. This will require grpc-go v1.3+
And, add
WithProtoErrorHandler
option andProtoErrorHandlerFunc
for handle errors asStatus
message in grpc-gateway instead of original error type a.k.aerrorBody
.This also unifies errors returned by gRPC server and errors happened inside grpc-gateway, which helps error handling in client.
I think discussion required for response status of errors inside grpc-gateway and how to handle errors for streaming.
If needed, I will separate this PR into two PRs.