On Tue, Oct 3, 2017 at 2:03 PM, Amit Saha <[email protected]> wrote:
> On Wed, Oct 4, 2017 at 7:53 AM 'Mehrdad Afshari' via grpc.io < > [email protected]> wrote: > >> [email protected] >> >> We were just discussing this with Nathaniel and the primary reason behind >> that API contract constraint, in addition to future-proofing by being >> conservative, is to prevent the user from accidentally not returning the >> return value of an OK-status RPC and having Python return None on your >> behalf without us being able to check for that bug. >> >> However, we do realize that is an issue, especially in the face of >> interceptors, and we were brainstorming three possible solutions (please >> let us know if you can think of more good ones or strong arguments for or >> against the following ones): >> >> 1. Relaxing the API docs to allow None to be returned from RPCs when the >> status is explicitly set to not OK, but still enforce that requirement for >> OK RPCs. >> 2. Defining a sentinel value e.g. grpc.NoResponse() that you would be >> able to return from non-OK status RPCs. This way, we can still enforce that >> you are explicitly returning something and not accidentally returning None. >> > > I think I like the combination of both (1) and (2). That is, if the status > is non-OK, only then allow grpc.NoResponse(). > This may not be possible depending on how issue 12824 <https://github.com/grpc/grpc/issues/12824> is resolved. 3. Allowing the handler to raise a sentinel exception type e.g. >> grpc.Abandon to accomplish the same thing. >> > > Do you mean, instead of having to set_details() and set_code(), we can > just do raise grpc.Abandon(code=<BLAH>, message=<BLAH>)? I think that would > be a friendly higher level addition to make. > Possibly. Thanks for looking into this! > Let's take further discussion over to issue 12826 <https://github.com/grpc/grpc/issues/12826>. -Nathaniel -- 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/CAEOYnAT4WpxAOyjaya78mAqgVO48qr5wZRr%2BF_DkOP76VNYo8g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
smime.p7s
Description: S/MIME Cryptographic Signature
