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

Use status package for error and introduce WithProtoErrorHandler option #378

Merged
merged 8 commits into from
May 12, 2017

Conversation

kazegusuri
Copy link
Contributor

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 and ProtoErrorHandlerFunc for handle errors as Status message in grpc-gateway instead of original error type a.k.a errorBody.
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.

@tmc
Copy link
Collaborator

tmc commented May 5, 2017

@kazegusuri thanks for this! this looks great. It looks like your generated swagger/openapi is a bit out of date.

@kazegusuri
Copy link
Contributor Author

It was actually caused by using newer version of protoc v3.3.0. I regenerated files with protoc v3.1.0.

@tamalsaha
Copy link
Collaborator

Hi, we would like to see this pr merged. The new status stuff looks great!

@kazegusuri
Copy link
Contributor Author

ready to be merged if no one opposes the response status.

@tmc tmc merged commit 7195ea4 into grpc-ecosystem:master May 12, 2017
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
@kazegusuri kazegusuri deleted the use-status branch May 27, 2017 05:54
@yugui yugui mentioned this pull request Jun 19, 2017
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants