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

blocking v2 client stub inconsistent about StatusRuntimeException verus StatusException #11937

Open
benjaminp opened this issue Mar 4, 2025 · 2 comments

Comments

@benjaminp
Copy link
Contributor

io.grpc.stub.BlockingClientCall uses the checked StatusException, so server-streaming and client-streaming v2 blocking RPCs have to deal with StatusException. However, the unary blocking v2 RPCs stubs have the implementation and thus behavior as v1; namely, all status exceptions are StatusRuntimeException. Should this be made consistent?

@kannanjgithub
Copy link
Contributor

The reason that we started using the checked exception is that we want to start moving in general to StatusException rather than StatusRuntimeException and the read/write methods in the BlockingClientCall already had other checked exceptions so it wasn't making things easier on the user if the status was unchecked.
ClientCalls and the old blocking stub are stable so we can't change from StatusRuntimeException to a checked exception even if we wanted to since we can't break existing code. The only way we could have the checked StatusException be thrown by unary blocking RPCs to to introduce new wrapper methods in BlockingClientCall that would catch and convert StatusRuntimeException to StatusException, however it doesn't appear like this is necessarily what you want.

@benjaminp
Copy link
Contributor Author

I'm just curious why this "blocking v2" interface is inconsistent. If the goal is to move to StatusException in general, why not make all blocking methods on the new interface throw the checked StatusException? Whether that requires adding new wrappers or not seems like an implementation detail.

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

No branches or pull requests

2 participants