Hi Nan,

ALREADY_EXISTS is never generated by the gRPC library. You can return this 
status from your service implementation. Please 
check https://github.com/grpc/grpc/blob/master/doc/statuscodes.md for more 
information.

Thanks,
Yuchen

On Thursday, September 7, 2017 at 2:32:01 AM UTC-7, [email protected] 
wrote:
>
> Hi all,
>
> Greetings from me! I am a newbie of using gPRC, and my service is so 
> simple:  
>
> service KeyDB {
> rpc Init(InitRequest) returns (InitResponse) {}
> }
>
> enum ServerResponse {
> SUCCESS = 0;
> ALREADY_EXISTS = 1;
> }
>
> message InitRequest {
> bytes pub_key = 1;
> }
>
> message InitResponse {
> ServerResponse response = 1;
> }
>
> The client just sends pub_key, and servers responses SUCCESS or key 
> ALREADY_EXISTS.
> I find the ServerResponse code is very similar as grpc::StatusCode. So my 
> Server::Init
> function always returns OK, and uses response to carry error code.
>
> grpc::Status Server::Init(grpc::ServerContext* context, request, response)
> {
>    ......
> response.set_response(ALREADY_EXISTS);
> ......
> return grpc::Status()
> }
> So is there any canonical way of processing when grpc::StatusCode are 
> partly or all overlapped 
> with service's response? Or are there any better solutions?
>
> Thanks very much in advance!
>
> Best Regards
> Nan Xiao
>

-- 
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/be4d7657-1961-487a-ae16-872f6c43c3e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to