Can you please share a minimal client code that exhibits the behavior?

On Tue, Aug 21, 2018 at 6:22 AM <[email protected]> wrote:

> Hi,
>
> I've been trying ascertain the correct way to handle error behaviour from
> streaming endpoints.
>
> My code effectively does the following:
>
> service MyService {
>     rpc StreamEndpoint(Request) returns (stream Response)
> }
>
> message Request {
>     repeated string query_ids = 1;
> }
>
> message Response {
>     string object_id = 1;
> }
>
> class MyService(MyServiceServicer):
>
>     def StreamEndpoint(self, request, context):
>         if not request.query_ids:
>             context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
>             context.set_details('Must set at least one id')
>             yield Empty()
>         for obj in self.db.query(id_list=request.query_ids):
>             yield obj.to_protobuf()
>
>
> I was expecting the client upon calling StreamEndpoint without query_ids
> to throw an RpcError (the client is also in Python) upon getting a code
> that isn't OK. However, it doesn't, even though the code in the response is
> correctly set to INVALID_ARGUMENT.
>
> Is this the correct behaviour? If so, what is usually the recommended way
> of handling these errors in python, as I have relied on the exception on
> non-streaming endpoints.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/92a1d587-c1d6-4e71-92ab-4d428d8c2152%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/92a1d587-c1d6-4e71-92ab-4d428d8c2152%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CABdARdCrnux9iiBMRjHW5iT9Cp9KR5upfmD-L9od1VQaSweiOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to