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

ability to customize stream errors #930

Merged
merged 5 commits into from
May 9, 2019

Conversation

jhump
Copy link
Contributor

@jhump jhump commented May 9, 2019

Fixes #584

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Thanks a ton for this - really excited about this new functionality! How would you feel about also adding a section about configuring the stream errors to our documentation?

runtime/mux.go Outdated Show resolved Hide resolved
runtime/proto_errors.go Outdated Show resolved Hide resolved
runtime/handler.go Outdated Show resolved Hide resolved
runtime/handler.go Show resolved Hide resolved
@jhump
Copy link
Contributor Author

jhump commented May 9, 2019

@johanbrandhorst, the build errors aren't making a lot of sense to me. I'm not a bazel user, but I understand the concepts (I've used blaze and pants). I tried to add a dependency from the runtime package to runtime/internal (surprised it was not already present), but that is still failing.

Any advice on getting the build green? I'm also really confused about the other errors, which appear to be related to Go modules. The confusing thing is that a few lines up from the error, it states that it resolved "github.com/grpc-ecosystem/grpc-gateway/runtime", but somehow can't resolve the "internal" sub-package therein :(

I can keep hacking, but if you can spot any simple issues in here, that would certainly speed things up.

@johanbrandhorst
Copy link
Collaborator

@johanbrandhorst, the build errors aren't making a lot of sense to me. I'm not a bazel user, but I understand the concepts (I've used blaze and pants). I tried to add a dependency from the runtime package to runtime/internal (surprised it was not already present), but that is still failing.

Any advice on getting the build green? I'm also really confused about the other errors, which appear to be related to Go modules. The confusing thing is that a few lines up from the error, it states that it resolved "github.com/grpc-ecosystem/grpc-gateway/runtime", but somehow can't resolve the "internal" sub-package therein :(

I can keep hacking, but if you can spot any simple issues in here, that would certainly speed things up.

Something about this import certainly seems to have got Go modules confused - I also have no idea what the hell is wrong here. I'll do some more investigating.

runtime/BUILD.bazel Outdated Show resolved Hide resolved
@johanbrandhorst
Copy link
Collaborator

Wait, runtime/internal isn't a package. You must mean github.com/grpc-ecosystem/grpc-gateway/internal? The internal package moved. @jhump.

@jhump
Copy link
Contributor Author

jhump commented May 9, 2019

Wait, runtime/internal isn't a package. You must mean github.com/grpc-ecosystem/grpc-gateway/internal? The internal package moved. @jhump.

Doh! Thanks for the tip. (You can probably tell that this patch was rebased from an older version of the repo. We've had it in a fork that is apparently pretty old: 463c5ed, from March 2018.)

@johanbrandhorst
Copy link
Collaborator

Wait, runtime/internal isn't a package. You must mean github.com/grpc-ecosystem/grpc-gateway/internal? The internal package moved. @jhump.

Doh! Thanks for the tip. (You can probably tell that this patch was rebased from an older version of the repo. We've had it in a fork that is apparently pretty old: 463c5ed, from March 2018.)

I celebrate the implication that you're trying to go back to the source :). I hope we can make you feel at home!

@codecov-io
Copy link

codecov-io commented May 9, 2019

Codecov Report

Merging #930 into master will increase coverage by 0.03%.
The diff coverage is 81.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #930      +/-   ##
==========================================
+ Coverage    53.5%   53.53%   +0.03%     
==========================================
  Files          40       40              
  Lines        3957     3964       +7     
==========================================
+ Hits         2117     2122       +5     
- Misses       1642     1645       +3     
+ Partials      198      197       -1
Impacted Files Coverage Δ
runtime/proto_errors.go 34.88% <100%> (+34.88%) ⬆️
runtime/mux.go 44.88% <25%> (-0.65%) ⬇️
runtime/handler.go 35.34% <77.77%> (-5.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15c7b2e...281c6ca. Read the comment docs.

runtime/handler.go Outdated Show resolved Hide resolved
@jhump
Copy link
Contributor Author

jhump commented May 9, 2019

@johanbrandhorst: I think this is ready for another pass, whenever you get a chance.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

How do you feel about my suggestion to add some documentation about this new feature too?

runtime/handler.go Show resolved Hide resolved
@jhump
Copy link
Contributor Author

jhump commented May 9, 2019

How do you feel about my suggestion to add some documentation about this new feature too?

I added a section to the "Customizing your Gateway" doc page. PTAL.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst 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 this fantastic contribution!

@johanbrandhorst johanbrandhorst merged commit f005bec into grpc-ecosystem:master May 9, 2019
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
* ability to customize stream errors

* fix build(?); review feedback

* default stream error handler; some other cleanup

* don't use ProtoErrorHandlerFunc for any stream calls -- not backwards compatible

* add details about stream error handler to docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors in response streams do not go through the registered error handler
4 participants