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

Add details to stream error response #561

Conversation

johanbrandhorst
Copy link
Collaborator

Add the gRPC status details to the streamed response.

This is built on top of #560, but I can close that one if we want to merge these together instead.

@johanbrandhorst
Copy link
Collaborator Author

Probably easiest to merge this and close #560 if we want both of these changes.

grpcCode = s.Code()
}
httpCode := HTTPStatusFromCode(grpcCode)
s, _ := status.FromError(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. I know it should never happen, but seeing the second return ignored is weird, too. Any thoughts about something like

s, ok := status.FromError(err)
if !ok {
  panic("err is no status")
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted to make use of the new status handling in gRPC-Go 1.10 which is equivalent to the old handling, but I accept gRPC-Gateway can't enforce that users have the latest gRPC version. I will change it back.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh that's a lovely function. Thanks for the pointer.

@johanbrandhorst johanbrandhorst force-pushed the add-details-to-stream-error-response branch from cd4034d to 345e924 Compare February 28, 2018 11:24
@johanbrandhorst johanbrandhorst force-pushed the add-details-to-stream-error-response branch from 345e924 to 16c3cee Compare March 5, 2018 17:00
@johanbrandhorst
Copy link
Collaborator Author

I hate to bump this but I think it's a pretty straightforward, backwards compatible change with a new test case and I'd really like to have this merged ASAP. Please advise if I can speed things up somehow.

@achew22
Copy link
Collaborator

achew22 commented Mar 6, 2018

I just reviewed this and I think it is good to go. Marking as approved. Can you please close any other PRs that this obviates and then I'll merge it (probably tomorrow morning/early afternoon US time)

@johanbrandhorst
Copy link
Collaborator Author

Closed #560 and #564.

@achew22
Copy link
Collaborator

achew22 commented Mar 7, 2018

Today was a disaster. Sorry for the slow merge. Merging now

@achew22 achew22 merged commit 07b39ba into grpc-ecosystem:master Mar 7, 2018
@johanbrandhorst johanbrandhorst deleted the add-details-to-stream-error-response branch March 7, 2018 09:14
@johanbrandhorst
Copy link
Collaborator Author

Any chance we could have a new release with this? 1.4.0?

ithinker1991 pushed a commit to tronprotocol/grpc-gateway that referenced this pull request Jun 18, 2018
…ctionById

fix address bug, address in index is hex
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
* Use the status Message when possible in errors
* Add details to stream error response.
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.

4 participants